Repository navigation
feat(dashboard): show a spinner on the project chip while a pick waits - #29562
Conversation
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The pending spinner traces back to #20351, and the file split is required by the line cap. The only thing worth questioning is the screenshot script that ships with the change. Notes
What this change shipsInventory (7 items) — 6 justifiedIntent: when someone picks a project on a chat that is starting a session, they can see the pick was taken instead of a chip that looks hung. This is an ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 45522f4 Description read[DESCRIPTION-READ] d71d93edc872934b94326b9c82e2b60d7fbe2ee6d68f44edd1c0877d4d48a39f That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the spinner state is a per-slot count kept next to the pick, it clears in Notes
[DESIGN-REVIEWED] 45522f4 Description read[DESCRIPTION-READ] 4c2d3938c3630725ab8e9c95da33b80496d2fa5739d1da311c535a0e808176c1 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing blocks. The blind reader read the pending chip as intended ("the app is moving from one project to another"), and all three states have screenshots at both widths. Notes
[UX-REVIEWED] 45522f4 Description read[DESCRIPTION-READ] 2c1ed2df7a01464b771a2f01c99f065e498380b86cc64a2c8294b24f80732125 That sha256 names everything this verdict read: the PR description, plus the 9 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
5d4a380 to
d666997
Compare
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]: UX Review on d666997 — addressed in 329e268. Blocker (pending state not read as "switching"): fixed. While a pick waits, the chip's visible label now reads "Switching project…" next to the spinner, in place of the old folder name. This matches the memory-mode chip, which shows its spinner beside "Switching memory mode…". The Note (failure toast vs. chip name): not changed here. The issue asks a failed pick to "use the existing error surface", and the toast text is the server's own refusal message, shared by every slot switch. After a failure the chip shows the project the chat actually has, so the chip is the true one. Naming the refused folder in the toast would change that shared notice for every switch, which is outside this PR's goal. |
329e268 to
b7c6626
Compare
b7c6626 to
45522f4
Compare
bolichen97
left a comment
There was a problem hiding this comment.
Approving 45522f4. The PR has 21 files; I read every hunk at this head: the product code, the new test, the capture script, and the one-line switching_project entry in each of the 13 locale files (en.json has no entry, the same as its sibling keys, which live in en.manual.json).
useSessionChoices.setProjectkeeps a per-slot count of picks in flight, raised before the request and lowered infinally, so it clears on success and on failure. A count rather than a flag means overlapping picks clear only after the last one, and a pick on one chat never shows on another.ChatInputswaps the folder icon for a spinningLoader2, shows "Switching project…" as the label, setsaria-busy, and announces it through ansr-onlyrole="status"line. The chip stays clickable, so the existing latest-wins ordering is unchanged.ComposerSizerandCOMPOSER_ROW_SPRINGmove unchanged intochat-input/ComposerSizer.tsx.- Tests cover the pending state, clearing on success and on failure, the per-chat scope, overlapping picks, and the chip's busy and idle render.
No regex, glob or case-blind matching is added in product code. The linked issue is T2. All 96 checks pass.
Problem / Motivation
Goal: While a project pick is still waiting, the project chip shows a spinner, so the pick no longer looks hung.
Picking a project calls
setProject, which waits onPOST /api/chat/slots/<slot>/project. That route waits on the slot's turn-preparation lock, and a cold spawn holds it for several seconds. The picker closes at once, but the chip keeps showing the old folder with no sign the pick was taken.Why it matters
Every user who switches project on a chat that is starting a session sees a control that looks broken for seconds. Some pick again, which only queues more requests behind the same lock.
Not a goal
What changed (motivation → approach → change)
useSessionChoices.setProjectawaitedperformSlotSwitchbut exposed nothing to render.setProjectkeeps a per-slot count of picks in flight and the hook returnsprojectSwitchingfor the active chat. A count, not a flag, so overlapping picks clear only after the last one ends, and a pick waiting on one chat never shows on another.ChatPagepasses it throughComposerDockViewtoChatInput.ChatInput: whileprojectSwitchingis true the folder icon becomes a spinningLoader2, the chip's visible label reads "Switching project…" in place of the old folder name, the chip setsaria-busy, and ansr-onlyrole="status"line announces the same text. This is the pattern the memory-mode chip already uses (spinner plus "Switching memory mode…" label).ChatInput.tsxwas at 1,999 lines and the file line cap is 2,000, soComposerSizerand its spring constantCOMPOSER_ROW_SPRINGmove whole, unchanged, intowebsite/src/components/chat-input/ComposerSizer.tsx.ChatInputimports both from there.components.chatInput.switching_projectin all 12 locales;en-XA.jsonregenerated.website/scripts/capture-20351-project-chip-pending.mjs: screenshot harness that holds the project route the way the gateway does.Backwards compatibility
Compatible: one new optional prop (
projectSwitching, default false) and one new catalog key; with no pick in flight the chip renders exactly as before.Removes nothing: the change only adds a pending state and a status line.
Tests
website/src/test/projectChipPending.test.tsx:api.chatSlotProjectbehind a barrier and checksprojectSwitchingis true while held, then false after success, with the server's stored project written;aria-busy="true", the visible "Switching project…" label and the matching status when pending, and the folder icon, the folder name and an empty status when not.Mutation check: making
projectSwitchingalways false reddens the three hook tests; removing the spinner andaria-busy, or restoring the folder name as the label while pending, each reddenproject chip > shows a spinner and announces the pending pick.Proof: not provable -- frontend test (prove.py runs Python only)
Also run green:
windowsProjectNameSites,ChatPage.pageOwners,ChatInputCoverage,ChatPage.memoryChip,src/i18ncatalog tests,tsc -p tsconfig.app.json, eslint on the changed files,i18n-check,gen-ui-index --check.Manual verification
Ran the screenshot harness against the built SPA (
website/dist) with fixtures and the project route held, at 1200px and 390px wide: pending, success, and failure frames below.Screenshots / video
Pending (route held): spinner and "Switching project…" on the project chip, picker closed.
Success and failure
Success: the new project shows and the spinner is gone.
Failure: the spinner is gone, the chip keeps the project it had, and the existing switch notice explains.
Related Issues
Closes #20351
Follow-up to #17729.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.