Skip to content

fix(seer-explorer): Clear input when switching sessions or starting new chat#115440

Merged
aliu39 merged 5 commits into
masterfrom
aliu/clear-input
May 12, 2026
Merged

fix(seer-explorer): Clear input when switching sessions or starting new chat#115440
aliu39 merged 5 commits into
masterfrom
aliu/clear-input

Conversation

@aliu39
Copy link
Copy Markdown
Member

@aliu39 aliu39 commented May 12, 2026

Summary

  • Wraps startNewSession and switchToRun in explorerDrawerContent.tsx to clear inputValue after each call, preventing stale text from persisting across session changes.

Test plan

  • Open Seer Explorer drawer, type something in the input
  • Click "New Chat" → input should be cleared
  • Switch to a different session → input should be cleared

aliu39 added 2 commits May 12, 2026 14:51
…ew chat

Wraps startNewSession and switchToRun to reset inputValue, so stale
text doesn't persist across session changes.
@aliu39 aliu39 requested a review from a team as a code owner May 12, 2026 21:54
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 12, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 12, 2026

📊 Type Coverage Diff

✅ No new type safety issues introduced. Coverage: 93.50%

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 63c2984. Configure here.

Comment thread static/app/views/seerExplorer/components/drawer/explorerDrawerContent.tsx Outdated
Comment thread static/app/views/seerExplorer/components/drawer/explorerDrawerContent.tsx Outdated
aliu39 added 2 commits May 12, 2026 15:10
… callback

Add optional onSuccess callback to switchToRun and startNewSession in
useSeerExplorer. The callback fires after state updates but not on
early return. explorerDrawerContent passes clearInput as onSuccess so
stale text doesn't persist across session changes.
Comment on lines 392 to 394
if (newRunId === runId) {
return;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: When starting a new chat from an unsent session, the input field is not cleared because an early return in switchToRunBase prevents the onSuccess callback from firing.
Severity: LOW

Suggested Fix

In the switchToRunBase function, move the onSuccess?.() call to before the early-return guard if (newRunId === runId) { return; }. This will ensure the callback is executed even when switching to the same runId, which includes the case where both are null.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: static/app/views/seerExplorer/hooks/useSeerExplorer.tsx#L392-L394

Potential issue: When `startNewSession` is called while a user is already in a new,
unsent session, the `runId` is `null`. The function calls `switchToRun(null, {onSuccess:
clearInput})`. Inside the `switchToRunBase` function, an early-return guard `if
(newRunId === runId)` evaluates to true because both `newRunId` and `runId` are `null`.
This causes the function to exit before the `onSuccess` callback (`clearInput`) is
invoked. As a result, if a user types text into the input field and clicks "New Chat"
without having first sent a message, the input field is not cleared.

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this is no-op, shouldnt clear

@aliu39 aliu39 merged commit e9c7f0b into master May 12, 2026
75 checks passed
@aliu39 aliu39 deleted the aliu/clear-input branch May 12, 2026 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants