fix(web): make itemMatchesRef workspace-aware in ItemDetail (IDEA-2135)#1008
Merged
Conversation
The no-{#key} switch-boundary predicate compared only ref/slug identity,
never workspace. On a reused embedded ItemDetail instance, navigating
ws1?item=TASK-1 -> ws2?item=TASK-1 (both workspaces owning TASK-1) kept
the predicate true across the switch, leaving collabKey pinned to ws1's
item.id and rawMode carried over until ws2's loadData resolved.
Stamp the wsSlug each item is loaded under (loadedItemWsSlug, lock-stepped
with item adoption inside the myItemGen===itemGen gate) and fold
loadedItemWsSlug === wsSlug into itemMatchesRef. scrollReady, collabKey,
resolvedIdentity, and the rawMode-reset gate all derive from it, so they
tighten together and stay consistent. Single-workspace usage is unchanged
(the arm is always true there).
TASK-2283.
Claude-Session: https://claude.ai/code/session_01EZ6yr6pAUFb1uffan912ra
xarmian
force-pushed
the
fix/itemdetail-ws-aware-matchesref
branch
from
July 22, 2026 23:30
1560823 to
d7d351e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Makes the no-
{#key}switch-boundary predicateitemMatchesRefinweb/src/lib/components/items/ItemDetail.svelteworkspace-aware.Why (IDEA-2135)
itemMatchesRefcompared only ref/slug/id identity, never workspace. On a reused embeddedItemDetailinstance, navigatingws1?item=TASK-1 → ws2?item=TASK-1— where both workspaces own aTASK-1— kept the predicatetrueacross the switch (wsSlugchanged butitemSlugstayedTASK-1and the{#if openItemRef}never unmounts the pane). Consequences untilws2'sloadData()resolved:collabKey— stayed pinned tows1'sitem.id, mounting a collab provider mis-keyed to the old item.itemMatchesRef, so raw markdown mode carried across the workspace switch.scrollReady,resolvedIdentity,collabKey, and the rawMode-reset gate all derive from this one predicate, so the correct fix is at the predicate level — they then tighten together and stay consistent (the fix the idea asked for).How
loadedItemWsSlug = reqWsSlugat the item-adoption point inloadData, inside the existingmyItemGen === itemGengate so it's lock-stepped withitemand the two can never disagree about which workspaceitembelongs to.loadedItemWsSlug === wsSluginto theitemMatchesRef$derived.The
Itemtype carriesworkspace_id(UUID) but the component only haswsSlug(slug); stamping the load-time slug avoids coupling to a slug→id resolver. Every otheritem =path (SSE refresh, archive, restore, migration refetch, sync, saves, version restore) operates on the same item in the current workspace, soloadedItemWsSlugcan't go stale relative toitem.Blast radius
In all single-workspace usage
loadedItemWsSlug === wsSlugis always true → byte-identical behavior. The arm only flipsfalsein the rare cross-workspace-reuse window (correctly). Barely reachable by design (no natural UI affordance preserves?item=across a workspace switch); filed as hardening.Gates
cd web && npm run check— svelte-check 0 errors.-s read-only, diffmain..HEAD) — CLEAN; specifically probed whetherloadedItemWsSlugcan go stale and wrongly falsify the predicate in single-workspace usage (it can't).Frontend-only; no
internal/store/dialect, MCP catalog, or collab-schema surface touched.Closes IDEA-2135. TASK-2283.
https://claude.ai/code/session_01EZ6yr6pAUFb1uffan912ra