Repository navigation
feat(fork): a main-list Cite in Chat + Replies goes to the message's replies - #154
Merged
Merged
Conversation
…replies In Chat + Replies, a Cite on a main-list message now opens that message's Replies view and puts the quote in its reply box. When the main box already shows text, the quote goes there; else when the open Replies view's box shows text, it goes into that box. Cites inside a Replies view, in other modes, from the dashboard and in side chats still go into their own box. The mounted reply box registers its composer for its thread, and a main-list cite reads what both boxes show at click time. A cold open runs inside flushSync, so the reply box has mounted and loaded its draft before the quote goes in, and the toolbar gets that box's real answer. When the Replies view opens as a sheet on a narrow screen, the sheet leaves focus to the quote's comment box. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This PR changes the test suite by +9 test cases (browser +1, unit +8, server 0). New browser test files: Keep tests that would fail for a real reason, and test logic below the UI where it can be. See Testing. |
1 task
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.
This pull request sends a Cite on a main-list message in Chat + Replies to that message's replies.
改了什么行为
Behaviour change: yes, in Chat + Replies a Cite on a main-list message opens that message's replies and puts the quote in their reply box, unless the main box or the open reply box already shows text.
Why
Before, a sent quote started a new first message, not a reply to the message it quotes.
Checks
Unit tests cover each route, refusals and blank boxes. A browser test at panel and sheet width checks the saved draft, a single quote and focus. The sheet case failed before its fix. The repo's checks for changed files pass. In the web app, each route worked at desktop and phone width.
How to undo
Revert the commit. Nothing is stored.
Design notes
subThreadCite.tskeeps one entry per thread for the mounted reply box.SubThreadViewpasses its own composer throughComposerHandleContext, which was null before, and registers it. That non-null context is why closing the reply box's model picker now moves focus back to the box.citeInThreadapplies the rule as three early returns. It reads both boxes' text from the composer handles at click time, so typing redraws nothing. While a question owns the main box, its typed answer is the text that counts.flushSync. React runs a sync commit's passive effects beforeflushSyncreturns, so the reply box has mounted and loaded its draft before the quote goes in, and the Cite button gets that box's real answer. No pending state is kept. A design review replaced an earlier step that parked the quote until the box mounted. That step reported success before the insert and could drop a quote or insert it again later.sheetInitialFocusreads a one-shot flag that a Cite's open sets, so the sheet leaves focus to the comment box. Without it, focus landed on "Close Replies", and Space or Enter closed the tab.apps/web/src/components/ChatView.tsx+2 −17,apps/web/src/components/RightPanelSheet.tsx+2 andapps/web/test/fakeEnvironment.ts+7 −3. InChatView.tsx, the cite is one call to the fork hook, off in side chats, and its local helper moved to the fork file.RightPanelSheet.tsxpassesinitialFocus={sheetInitialFocus}.fakeEnvironment.tstakes asettingsoption, so a browser test can set Chat + Replies. The README's Chat + Replies line gains one sentence.