Skip to content

enhancement(paints): reactive hue filter counts on the paint explorer - #148

Open
NathanHealea wants to merge 6 commits into
mainfrom
enhancement/reactive-hue-filter-counts
Open

enhancement(paints): reactive hue filter counts on the paint explorer#148
NathanHealea wants to merge 6 commits into
mainfrom
enhancement/reactive-hue-filter-counts

Conversation

@NathanHealea

Copy link
Copy Markdown
Owner

Summary

Makes the paint count next to every hue option in HueFilterBar (parent hues and, when a parent is selected, child hues) reactive to the active free-text query and every other filter, instead of showing static full-library totals. Zero-count hue pills stay visible and clickable but render muted, so the hue dimension never reflows or disappears.

Implements docs/02-paint-data-search/13-paint-explorer-reactive-hue-counts.md by extending plan 10's existing getPaintFacetCounts surface rather than adding a parallel hue-only path.

What changed

  • PaintFacetCounts type gains hue and childHue maps (lowercased-name keys).
  • getPaintFacetCounts service computes two additional count sets under the OR-within-dimension hold-out rule:
    • parent-hue counts: each top-level hue counted over its children's hue_ids, ANDed with all non-hue filters (hue dimension held out) so selecting a hue never zeroes its siblings;
    • child-hue counts: populated only when a parent is selected, each child counted independently by its own hue_id.
    • Signature adds parentHueId / childHueId alongside the existing hueIds (additive, non-breaking).
  • usePaintFacetCounts hook forwards parentHueId / childHueId and re-fetches when they change.
  • useHueFilter hook no longer fetches child paint counts — it only fetches the structural child-hue list; counts now come from the single facet-counts source.
  • HueCard / ChildHueCard gain an isEmpty prop that applies a muted (opacity-60) treatment while keeping the pill visible and clickable.
  • /paints route resolves the child-hue UUID and makes a single getPaintFacetCounts call with the hue args for a correct first paint (no flash of stale full-library counts); the per-hue getPaintCountByHueGroup loop and the legacy static huePaintCounts prop are removed.

Verification

  • npm run build — compiles successfully.
  • npm run lint — 0 errors (pre-existing warnings only, none in touched files).
  • tsc --noEmit — clean.
  • No test framework configured; verification is manual per CLAUDE.md.

All acceptance criteria in the feature doc are checked off. Version bumped 1.77.0 → 1.78.0.

Notes for reviewer

  • The service signature is additive (parentHueId / childHueId added next to the existing hueIds) rather than the doc's suggested replace-hueIds approach. This keeps hueIds correct for the brand/type/line counts, avoids a breaking change across call sites, and keeps every commit green. childHueId is held out automatically because each child is counted independently by its own hue_id.
  • getPaintCountByHueGroup is retained (still used by /hues/[id]), so it was not deprecated in this PR.

Resolve the child hue UUID and pass parentHueId/childHueId into the single getPaintFacetCounts call so SSR-prefetched hue pill counts respect the active query and filters. Drop the per-hue getPaintCountByHueGroup loop and the legacy static huePaintCounts prop.
Check off all acceptance criteria and cross-link the reactive hue-count coverage from the plan-10 filters doc.
@vercel

vercel Bot commented Aug 1, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
grimify-app Ready Ready Preview Aug 1, 2026 12:01am

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