[PR #11093] fix(tui): resolve EditBuffer destroyed error in dialog-select #13653

Open
opened 2026-02-16 18:18:29 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/11093

State: open
Merged: No


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.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/11093 **State:** open **Merged:** No --- 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.
yindo added the pull-request label 2026-02-16 18:18:29 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13653