explorer: sync #facetNote on URL deep-link + mode transitions (#234 step 1)#235
Conversation
|
Code review result: no code-level issues found in this PR. I checked the PR patch around the centralized Validation run locally:
Merge blocker: GitHub currently reports |
…esorg#234 step 1) Restoring facet checkboxes from `?material=…&context=…` runs through `setCheckedValues`, which does not fire the `change` event — so the cluster-mode honesty note (`#facetNote`, "filter takes effect at neighborhood zoom") stayed hidden on shared deep-links even with active filters. A user arriving via a URL saw dimmed cluster dots with no explanation. While there, the same visibility logic was missing from the mode transitions: a user in cluster mode with the note showing kept seeing it after zooming to point mode, and vice versa. Fix: extract `syncFacetNote()` as the single source of truth for the visibility invariant visible ⇔ (any facet active) ∧ (mode === 'cluster') and call it from the four state-mutation sites: - facetFilters cell (URL deep-link restore) - handleFacetFilterChange (user toggles a facet checkbox) - enterPointMode / exitPointMode (mode transitions) Validation: - New spec `tests/playwright/facetnote-url-load.spec.js` covers the deep-link case (note visible with `?material=`) and the negative control (note hidden with no facet params). Confirmed the spec fails against pre-fix code and passes against the fix. - Full `url-roundtrip.spec.js` (5 tests, including point-mode deep-link and back/forward) passes — no regression. Roadmap step 1 of isamplesorg#234. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
40555bd to
230e763
Compare
|
Rebased onto upstream/main (was branched off a stale fork-main). Single conflict was in Re-ran both suites against the rebased commit (
|
Summary
Roadmap step 1 of #234 (filter-semantics architectural direction). Pure bug fix, no behavior change beyond making the cluster-mode honesty note (
#facetNote) honest in two cases where it had drifted out of sync./explorer.html?material=…restored checkbox state viasetCheckedValues, which doesn't fire thechangeevent, so#facetNotestayed hidden even with active filters. A user opening a shared URL saw dimmed cluster dots with no explanation.handleFacetFilterChange. A user in cluster mode with the note showing kept seeing it after zooming to point mode (and vice versa).Fix: extract
syncFacetNote()as the single source of truth for the visibility invariantand call it from the four state-mutation sites:
facetFilterscell (URL deep-link restore)handleFacetFilterChange(user toggles a facet checkbox)enterPointMode/exitPointMode(mode transitions)Test plan
tests/playwright/facetnote-url-load.spec.js:?material=<uri>→#facetNotevisible#facetNotehidden (negative control)expected: 'block', received: 'none') and PASSES against the fix.tests/playwright/url-roundtrip.spec.js(5 tests, includes point-mode deep-link and cross-context round-trip) passes — no regression./explorer.html?material=<any URI>and confirm note appears under the cluster legend.Notes for review
This PR is intentionally scoped to step 1 of the #234 roadmap (the 1–2 hour bug fix). It does not touch:
applyQueryToFacetFiltersitself (the URL-param read path is unchanged)refreshFacetCountscross-filter live-query path (B1 work, step 3)The roadmap synthesis with sign-off and revised sequencing is in issue #234.
🤖 Generated with Claude Code