Skip to content

fix: resolve race condition in terminal initialization - #100

Closed
kanetronv2 wants to merge 1 commit into
mainfrom
claude/issue-86-20250531_011110
Closed

kanetronv2 wants to merge 1 commit into
mainfrom
claude/issue-86-20250531_011110

Conversation

@kanetronv2

Copy link
Copy Markdown
Contributor

Fixes #86

Resolves race condition where users could type before the prompt was displayed, causing input to be overwritten or appear over the prompt.

Changes:

  • Move term._initialized = true to run after term.prompt() display
  • Maintain performance optimizations with 100ms delay for background loading
  • Ensure proper sequence: terminal setup → prompt display → interactive → background loading

The terminal cursor is now consistently responsive without the race condition.

Generated with Claude Code

Fixes issue where users could type before prompt was displayed by:
- Moving `term._initialized = true` to run after `term.prompt()` display
- Maintaining performance optimizations with 100ms delay for background loading

This ensures proper sequence: terminal setup → prompt display → interactive → background loading

Co-authored-by: kanetronv2 <kanetronv2@users.noreply.github.com>
@ledwards

Copy link
Copy Markdown
Contributor

Same story as #98 — real problem, fixed by #109 along a different path.

The terminal no longer waits on window.onload at all; it initializes on DOMContentLoaded, and the preloading this PR wanted to defer now runs through window.scheduleIdleTask. The _initialized ordering this changes was rewritten with it.

Conflicts against the current files with nothing left to port, but the race you identified was real and is gone.

@ledwards ledwards closed this Aug 13, 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.

the cursor loads too slowly

2 participants