EditorThreadBar.tsx renders a static 10-color picker with random lengths disconnected from the Workspace's actual threadStops #94
Labels
No labels
blocked:commit-ready-failed
blocked:gate-fetch
blocked:gate-lint
blocked:gate-plan
blocked:gate-research
blocked:needs-attention
blocked:needs-decision
blocked:needs-human
blocked:no-changes
blocked:verify-failed
bug
deferred
feature-request
in-progress
needs-decompose
needs-triage
quickfix
security/medium
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/Kimi_Agent_Brother_10_Digitizing_App#94
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Where:
src/components/editor/EditorThreadBar.tsx(79 lines).Bug: The thread bar along the bottom of the Editor presents itself as a "thread stops" picker but is fully static and disconnected from the actual design.
Issues:
Hard-coded 10 colors/names that don't reflect
THREAD_COLORSlength (src/components/editor/constants.ts). If THREAD_COLORS has fewer than 10 entries, accessingTHREAD_COLORS[i]fori >= lengthisundefinedand renders nothing for that stop. If it has more, only 10 are shown. The bar pretends to be a picker over the full catalog but actually shows a 10-color subset.Length is randomized (
Math.random() * 85). Wrapped inuseState(getThreadStops)so it's stable across re-renders, but the value is meaningless — there is no per-stop length in the underlyingstate.threadStops. The field is computed but never displayed.No connection to
state.threadStops. The Workspace produces real thread stops viacomputeThreadStops(stitchObjects)inuseWorkspace.ts:568, passed through thetc_workspace_snapshotsessionStorage bridge into the Editor. But the Editor thread bar ignores the snapshot'sthreadStopsand instead generates fake data on mount.ThreadStopinterface (L5-10) is locally redefined with a different shape than the Workspace'sThreadStop(insrc/components/workspace/types.ts, fields:id, colorId, paletteIndex, hex, length). The local interface omitscolorId,paletteIndex,hex,idand only hascolor, index, name, length. So even if the bar were ever wired to read real stops, the types would need to be unified first.useStatewith no setter ([stops]) — the function returns[stops]and never calls setStops. Minor stylistic issue but signals "this is read-only seed data, not interactive state".Effect on user: when the user navigates from Workspace (post-digitize, with 8 real thread stops derived from the design's colors) →
/editor, the thread bar at the bottom shows 10 generic named colors with random lengths, not the design's actual thread palette. The user can't see which threads their design uses, can't reorder real stops, can't pick "the actual blue I see in my design". TheselectedThreadIndex(controlled by clicking these) is used asTHREAD_COLORS[currentThreadIndex]forcurrentThreadColorpassed to the canvas (Editor.tsx:532) and as the color for newly drawn paths (Editor.tsx:381,threadColor: THREAD_COLORS[currentThreadIndex]). So clicking changes the next-path-draw color, but the user has no idea which color is which in the design.Fix consistent with existing patterns: Two paths, pick one.
Wire to the snapshot. Read
tc_workspace_snapshotfrom sessionStorage (already done byEditor.loadInitialPathsat Editor.tsx:35) and parse outthreadStops. Pass them down as a prop:Editor.tsx, on mount, parse the snapshot once:const [threadStops] = useState(() => { const raw = sessionStorage.getItem('tc_workspace_snapshot'); return raw ? (JSON.parse(raw).threadStops ?? []) : []; });threadStops={threadStops}to<EditorThreadBar />at Editor.tsx:561.EditorThreadBarProps(L12-15) withthreadStops: ThreadStop[]matching the Workspace type. Render one stop per real entry: swatchstop.hex, labelstop.paletteIndex + 1or stop name if you add one. Drop theMath.random()length field entirely.Honest defer. If the bar is purely cosmetic, mark it
disabledor hide it entirely when no thread stops are available:Or render a single "No threads yet — digitize a design first" message. Match what #71/#76 did for orphan UI: be honest about scope.
Recommended: Path 1. The snapshot already has the data, the bridge already exists, the only missing piece is reading threadStops alongside stitchObjects and passing them down. ~30 lines of changes.
Severity: low — the user can still pick a color and draw new paths, the click handler does work. But the bar misrepresents the design's actual threads, which is confusing. Same orphan-UI family as #71 / #76 / #88 / #91.
Fixed in commit
91acc5fonorigin/main(kilo-gsd.py Phase 8/9 Commit landed). Followed up by5539429(REORDER_STITCH_OBJECTS + threadStops prop). EditorThreadBar now reads the workspace snapshot and renders one stop per real thread entry. Closing this card as pre-completed.