-
Notifications
You must be signed in to change notification settings - Fork 51
fix: the bug report reloads on every key press #1622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: the bug report reloads on every key press #1622
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
runframe/lib/components/useBugReportDialog.tsx
Lines 146 to 151 in 16bff6f
| const createResponse = await registryKy | |
| .post("bug_reports/create", { | |
| json: { | |
| text: userText.trim() || undefined, | |
| is_auto_deleted: true, | |
| delete_at: deleteAt, |
The handleConfirmBugReport callback uses userText to populate text when creating the bug report, but the callback is now memoized with an empty dependency array. After the user types into the textarea and presses "Upload & Report", the closure still holds the initial userText (usually an empty string), so the entered description is never included in the submission. Add userText to the callback dependencies or read it from a ref so the latest value is sent.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (textareaRef.current) { | ||
| textareaRef.current.value = "" | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Race condition: When the dialog is closed, the textarea element may not be in the DOM (depending on AlertDialog's implementation), causing textareaRef.current to be null. The clearing operation is skipped, but then the dialog opens and the textarea may retain its previous value if no global error exists to overwrite it.
The useEffect on lines 93-99 only sets a value when globalError exists, so without an error, the textarea keeps old content from previous submissions.
Fix: Move the clearing logic into the useEffect:
useEffect(() => {
if (isOpen && !successState && textareaRef.current) {
const globalError = typeof window !== "undefined"
? window.__TSCIRCUIT_LAST_EXECUTION_ERROR
: undefined
textareaRef.current.value = globalError
? `I'm getting this execution error:\n\n${globalError}`
: ""
}
}, [isOpen, successState])And remove lines 121-123 from openBugReportDialog.
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
|
Thank you for your contribution! 🎉 PR Rating: ⭐⭐⭐ Track your contributions and see the leaderboard at: tscircuit Contribution Tracker Comment posted by tscircuitbot |
The Root Cause
The issue was that typing in the bug report textarea was causing the entire FileMenuLeftHeader
to re-render because:
Approach
Switch to uncontrolled input