Skip to content

fix(pivot): four axis-filter bugs found in review - #15

Merged
bvallier merged 1 commit into
masterfrom
claude/sales-frequency-strategy-tco8pw
Sep 1, 2026
Merged

bvallier merged 1 commit into
masterfrom
claude/sales-frequency-strategy-tco8pw

Conversation

@bvallier

@bvallier bvallier commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the four bugs in the axis value filter feature (#10 / 6baada5) surfaced by a code review of that diff.

Changes

  1. React leaked filters across datasets (packages/react/src/hooks/usePivotTable.ts) — switching the data prop to a dataset with no saved config reset the pivot axes but not fieldFilters, so exclusions from the previous dataset silently filtered the new one and were persisted under its storage key. The invalid-config branch now clears filters, mirroring Vue's clearConfig().

  2. "Exclude all" looked like "not configured" (both PivotSkeletons) — filtering out every row made computePivotResult return null, which rendered the generic "Your pivot table will appear here" placeholder with no hint that filters were the cause. When filters are active and the result is empty, the placeholder now says "All rows are hidden by axis filters — adjust or clear the filters to see results". Plumbed via a new optional hasActiveFieldFilters prop.

  3. Unbounded filter panel (both PivotConfigs) — the panel mounted one checkbox per unique field value, freezing the tab on high-cardinality columns (IDs, timestamps). Rendering is capped at 200 values with a "N more — search to narrow the list" hint; the All/None quick actions still operate on the full value set.

  4. Duplicate stringification contract (packages/core/src/pivot/drillthrough.ts) — a private stringifyFieldValue duplicated the exported stringifyPivotValue; divergence would desync drill-through row matching from pivot key building. Deleted in favor of the shared helper.

Verification

  • pnpm lint, pnpm build, pnpm type-check all clean
  • pnpm test:unit — 241/241 passing; the existing blank-handling drill-through tests (tests/unit/pivot.test.ts) lock the stringification contract touched in (4)
  • Fixes are mirrored symmetrically between the Vue and React packages

Generated by Claude Code

1. React: switching datasets with an invalid config reset the pivot axes
   but not fieldFilters, so exclusions from the previous dataset silently
   filtered the next one and were persisted under its storage key. Clear
   filters in that branch, mirroring Vue's clearConfig().

2. Filtering out every value rendered the generic "Your pivot table will
   appear here" placeholder, indistinguishable from an unconfigured
   pivot. Both skeletons now say the rows are hidden by axis filters when
   filters are active and the result is empty.

3. The axis filter panel mounted one checkbox per unique field value with
   no cap, freezing the tab on high-cardinality columns. Rendering is now
   capped at 200 values with a "N more — search to narrow the list" hint;
   the All/None quick actions still act on the full value set.

4. drillthrough.ts kept a private copy of the value-stringification
   contract that packages/core exports as stringifyPivotValue; the two
   could silently diverge and desync drill-through matching from pivot
   key building. Use the shared helper.

Verified: lint, build, type-check, and unit tests (241/241) all pass;
existing blank-handling drill-through tests cover the contract in (4).
@vercel

vercel Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
tiny-pivot Ready Ready Preview Sep 1, 2026 11:34am UTC

Request Review

@bvallier
bvallier merged commit e473274 into master Sep 1, 2026
5 checks passed

This branch was successfully deployed

1 active deployment
Preview — 7f0f39ec Deployed Sep 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant