Skip to content

fix(tui): resolve EditBuffer destroyed error in dialog-select#11093

Closed
njyeung wants to merge 2 commits intoanomalyco:devfrom
njyeung:fix/tui-editbuffer-destroyed-error
Closed

fix(tui): resolve EditBuffer destroyed error in dialog-select#11093
njyeung wants to merge 2 commits intoanomalyco:devfrom
njyeung:fix/tui-editbuffer-destroyed-error

Conversation

@njyeung
Copy link
Copy Markdown

@njyeung njyeung commented Jan 29, 2026

Fixes #10926

Fixes race condition where input focus was called on a potentially stale reference before the EditBuffer was fully initialized.

What does this PR do?

The problem stems from a race condition where input.focus() was being called on a potationally stale closure variable before EditBuffer was fully initialized. Changing to queueMicrotask instead of setTimeout for more immediate execution and r.focus() instead of input.focus() to ensure we're focusing the instance that was just created.

How did you verify your code works?

Verified by testing provider connection flow (Moonshot AI) which previously crashed with "EditBuffer is destroyed" error.

Fixes race condition where input focus was called on a potentially
stale reference before the EditBuffer was fully initialized.

Changed from setTimeout with closure variable to queueMicrotask
with direct parameter reference to ensure the correct input
instance is focused.

Verified by testing provider connection flow (Moonshot AI)
which previously crashed with "EditBuffer is destroyed" error.
@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@github-actions
Copy link
Copy Markdown
Contributor

Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR.

@github-actions github-actions bot closed this Mar 30, 2026
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.

Error appear after connecting provider

1 participant