fix(filter-builder): id labels resolve at render — refresh keeps names
Refresh showed raw uuids in id-kind value cells (feed/library/ collection/added_by). Two defects, one story: 1. Only ids persist in filter trees; the client's id→label cache dies with the page. The quiet re-resolution fetch reused the suggest facet, whose rows are MEDIA-CONSTRAINED (INNER JOIN media_items + the tree's sibling rules as a constraint) — so an id whose media doesn't match got no row and no label. Live repro: "feed in [A,B,C] AND title contains Chapter" labeled one feed of three (live-request evidence: 200 with total:1). A label is a property of the entity row, not of what currently matches. Fix: pages that render a tree resolve labels SERVER-SIDE at render and embed the map on the mount (data-id-labels) — the collection editor (stored tree) and the bookshelf (URL qf). New SearchService.FilterTreeLabels reads the entity tables with no media join and no tree constraint; scoping rides the request identity through the scoped handle (podcast_feeds/collections RLS — an invisible id resolves to nothing; pinned), libraries mirror the facet's visibility join. A feed with ZERO episodes resolves its title — pinned; that case was structurally impossible before. 2. The bookshelf drawer never hydrated at page load at all: the only load-time hydrate calls live in the PARENT's x-init (initBookshelf), and Alpine initializes parents before nested components — builderData() was null there, so hydrateFromForm no-oped and a URL-qf refresh left the drawer with an empty seeded rule while the grid stayed filtered. The drawer now hydrates in its OWN init when the mount carries no data-tree; the init-order contract is pinned in vitest (185/185). The quiet suggest fetch remains only as a fallback for trees the SSR never saw; embedded labels make it a no-op on refresh. Interactive menus are untouched (their constrained, count-bearing behavior is correct for choosing). Pins: TestRulesPageEmbedsIdLabels (zero-episode feed labels at render, bookshelf qf library label, hidden library NOT labeled); filter/episode-tree/search-contract/RLS/playlist container slices green; contract_pins entry documents the embed contract.
This commit is contained in:
1 parent
c448fa438f
commit
65f257f377
12 files changed
+533
-80
No files matched your search
@@ -619,3 +619,33 @@ offered-vocabulary narrowing, not a parse change:
|
||||
- Client id-cells are uniform: every operator on an id-valued field
|
||||
accepts a set, so all id cells say "pick one or more" and accumulate
|
||||
picks — no per-operator placeholder/pick distinction to explain.
|
||||
|
||||
## 2026-11-01 — id labels resolve at render (SSR embed): refresh keeps names
|
||||
|
||||
Pages that render a filter tree embed the tree's id→name map at render
|
||||
time (`data-id-labels` on the builder mount) — the collection editor
|
||||
(stored tree) and the bookshelf (URL `qf`). Before this, refresh showed
|
||||
raw uuids: only ids persist in trees; the client's id→label cache dies
|
||||
with the page, and the quiet suggest fetch reused the MEDIA-CONSTRAINED
|
||||
facet, so an id whose media doesn't match the tree's sibling rules got
|
||||
no row and no label (live repro: `feed in [A,B,C] AND title contains
|
||||
Chapter` labeled one feed of three — two feeds had no "Chapter"
|
||||
episodes).
|
||||
|
||||
- `SearchService.FilterTreeLabels` reads the ENTITY tables (no media
|
||||
join, no tree constraint): podcast_feeds and collections are
|
||||
RLS-governed through the scoped handle (invisible ids resolve to
|
||||
nothing); libraries mirror the facet's visibility join; added_by is a
|
||||
plain username lookup. A zero-episode feed resolves its title —
|
||||
pinned (TestRulesPageEmbedsIdLabels), as is the hidden-library
|
||||
non-resolution.
|
||||
- The bookshelf drawer also HYDRATES at component init now (no
|
||||
data-tree mount → read the form): the parent's x-init
|
||||
(initBookshelf) runs BEFORE the nested builder component exists
|
||||
(Alpine initializes parents first), so its builderData() call was
|
||||
null and a URL-qf refresh left the drawer with an empty seeded rule
|
||||
while the grid stayed filtered. Init-order contract pinned in
|
||||
filter_builder.test.ts.
|
||||
- The quiet suggest fetch remains only as a fallback for trees the SSR
|
||||
never saw (client-side apply flows); embedded labels make it a no-op
|
||||
on refresh.
|
||||
Reference in new issue
Block a user