Skip to content

Fix cursor navigation silently dropped or misapplied during file model attachment#55

Merged
rushabhcodes merged 1 commit into
tscircuit:mainfrom
rushabhcodes:fix-workspace-navigation-reveal-race
Jul 20, 2026
Merged

Fix cursor navigation silently dropped or misapplied during file model attachment#55
rushabhcodes merged 1 commit into
tscircuit:mainfrom
rushabhcodes:fix-workspace-navigation-reveal-race

Conversation

@rushabhcodes

Copy link
Copy Markdown
Contributor

What

Workspace file navigation (sidebar click, breadcrumb "reveal", go-to-definition,
search "reveal match") had two independent code paths for applying the
resulting cursor reveal/focus, and they had drifted:

  • revealLocation applied the reveal without checking that the target file's
    model was actually attached to the editor yet — if called during a model
    swap, it could apply position/focus against the wrong (stale) file's model.
  • selectFile had that attachment check, but on failure it silently dropped
    the navigation request with no fallback — the reveal just never happened.

Fix

Both paths now route through a single mechanism: navigation requests record
intent and a lone effect applies the reveal once the target model is
confirmed attached, retrying via the model-swap effect if it isn't ready yet.
No entry point can lose a request or apply it against the wrong model anymore.

Testing

Manually verified in the Cosmos TscircuitWorkspace fixture:

  • Sidebar file switch (cross-file) — model swap + reveal correct
  • Reselecting the already-active file — no crash, no dropped reveal
  • Ctrl+click go-to-definition across files — correct model swap, reveal,
    and focus, confirmed via console (no errors)

No behavior change to the public API (revealLocation return contract,
onFileSelect prop) — internal only.

…l attachment

Workspace file navigation (sidebar click, breadcrumb reveal, go-to-definition,
search reveal-match) had two independent code paths for applying the
resulting cursor reveal/focus, and they had drifted:

- revealLocation applied the reveal without checking that the target file's
  model was actually attached to the editor yet, so a call during a model
  swap could apply position/focus against the wrong (stale) file's model.
- selectFile had that attachment check, but on failure it silently dropped
  the navigation request with no fallback.

Both paths now route through a single mechanism: navigation requests record
intent, and one effect applies the reveal once the target model is confirmed
attached, retrying via the model-swap effect if it isn't ready yet. No entry
point can lose a request or apply it against the wrong model anymore.
Copilot AI review requested due to automatic review settings July 20, 2026 17:25
@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
monaco-code-editor Ready Ready Preview, Comment Jul 20, 2026 5:25pm

Request Review

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@rushabhcodes
rushabhcodes merged commit 398dd08 into tscircuit:main Jul 20, 2026
5 checks passed
@rushabhcodes
rushabhcodes deleted the fix-workspace-navigation-reveal-race branch July 20, 2026 17:25
@tscircuitbot

Copy link
Copy Markdown
Collaborator

Thank you for your contribution! 🎉

PR Rating: ⭐⭐⭐
Impact: Major

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


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.

3 participants