Skip to content

Conversation

@imrishabh18
Copy link
Member

@imrishabh18 imrishabh18 commented Oct 29, 2025

The Root Cause

The issue was that typing in the bug report textarea was causing the entire FileMenuLeftHeader
to re-render because:

  1. useBugReportDialog had state that changed on every keystroke (userText)
  2. This hook was called inside FileMenuLeftHeader
  3. Every state change triggered a re-render of the entire component tree

Approach

Switch to uncontrolled input

@vercel
Copy link

vercel bot commented Oct 29, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
runframe Ready Ready Preview Comment Oct 30, 2025 1:11pm

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

const createResponse = await registryKy
.post("bug_reports/create", {
json: {
text: userText.trim() || undefined,
is_auto_deleted: true,
delete_at: deleteAt,

P1 Badge Submit bug reports with current text

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".

Comment on lines +121 to +123
if (textareaRef.current) {
textareaRef.current.value = ""
}
Copy link
Contributor

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

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@imrishabh18 imrishabh18 requested a review from seveibar October 30, 2025 13:16
@imrishabh18 imrishabh18 merged commit 898e178 into main Oct 30, 2025
8 checks passed
@imrishabh18 imrishabh18 deleted the rishabh/tsc-69-bug-report-modal-in-runframe-flashes-and-knocks-cursor-out branch October 30, 2025 16:41
@tscircuitbot
Copy link
Collaborator

Thank you for your contribution! 🎉

PR Rating: ⭐⭐⭐
Impact: Major

Track your contributions and see the leaderboard at: tscircuit Contribution Tracker


Comment posted by tscircuitbot

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants