Skip to content

fix: prevent stale conversation messages during session switch - #18140

Merged
wangq8 merged 1 commit into
infiniflow:mainfrom
dcc123456:fix/stale-conversation-messages
Aug 12, 2026
Merged

wangq8 merged 1 commit into
infiniflow:mainfrom
dcc123456:fix/stale-conversation-messages

Conversation

@dcc123456

Copy link
Copy Markdown
Collaborator

Summary

fix: prevent stale conversation messages during session switch

@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Aug 12, 2026
@dcc123456
dcc123456 requested a review from wangq8 August 12, 2026 02:53
@dcc123456 dcc123456 added 🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration labels Aug 12, 2026
@dcc123456
dcc123456 marked this pull request as draft August 12, 2026 02:53
@dcc123456
dcc123456 marked this pull request as ready for review August 12, 2026 02:54
@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ae1cac36-f5ef-4c1d-b37e-ea6f52c8c569

📥 Commits

Reviewing files that changed from the base of the PR and between c0274ff and 9cffa9c.

📒 Files selected for processing (1)
  • web/src/pages/next-chats/chat/chat-box/single-chat-box.tsx

📝 Walkthrough

Walkthrough

SingleChatBox now prevents stale conversation messages from applying during conversation switches. Its synchronization effect also responds when conversation?.id changes.

Changes

Conversation synchronization

Layer / File(s) Summary
Guard stale conversation messages
web/src/pages/next-chats/chat/chat-box/single-chat-box.tsx
SingleChatBox skips conversation messages when the conversation ID differs from the current URL conversation ID. The synchronization effect now depends on conversation?.id.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: 🧰 typescript

Suggested reviewers: cike8899

Poem

I guard each chat as switches flow,
So stale old messages cannot grow.
When IDs change, I check anew,
And keep the current thread in view.
— A careful rabbit 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: preventing stale conversation messages during session switches.
Description check ✅ Passed The description includes the required Summary section and clearly states the purpose of the change, but provides limited background context.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@wangq8 wangq8 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good fix for a race condition during conversation switching. The guard conversation?.id !== conversationId correctly prevents stale messages from leaking into a new session. Adding conversation?.id to the dependency array is the right call since the effect now reads it. LGTM.

@wangq8
wangq8 merged commit 4a6bed8 into infiniflow:main Aug 12, 2026
9 checks passed
JinHai-CN pushed a commit that referenced this pull request Aug 19, 2026
## Summary

Add focused frontend regression coverage for stale conversation messages
during chat session switching.

Related: #18140.

Replaces #18208.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants