fix: hide tab progress bar when opening pre-loaded ESM dependency#1748
Merged
willeastcott merged 2 commits intomainfrom Feb 12, 2026
Merged
fix: hide tab progress bar when opening pre-loaded ESM dependency#1748willeastcott merged 2 commits intomainfrom
willeastcott merged 2 commits intomainfrom
Conversation
When an ESM script (e.g. b.mjs) imports from another script (e.g. a.mjs), the dependency is pre-loaded into documentsIndex. If the user later opens a.mjs directly, documents-load.ts sees it is already loaded and emits documents:focus instead of re-running loadDocument. Since documents:load never fires again, the newly created tab's progress bar was never hidden. Check whether the document was already loaded when creating a new tab and hide the progress bar immediately if so. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a UI bug where the tab progress bar can remain visible indefinitely when opening an ESM asset that was previously pre-loaded as a dependency, by hiding progress immediately for already-loaded documents.
Changes:
- Adds an early progress-hide check when creating a new tab for an already-loaded document.
- Uses
documents:get+documents:isLoadingto determine whetherdocuments:loadwill fire.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
kpal81xd
approved these changes
Feb 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
b.mjs(which importsa.mjs), close it, then opena.mjs-- the progress bar under the tab never hidesRoot Cause
When an ESM script (e.g.
b.mjs) loads,documents-load.tspre-loads its dependencies (e.g.a.mjs) intodocumentsIndexvialoadDocument(a.mjs, false). Later, when the user opensa.mjsdirectly, theselect:assethandler indocuments-load.tsseesdocumentsIndex[a.id]already exists and takes a fast path -- emittingdocuments:focusinstead of callingloadDocument. Sincedocuments:loadnever fires again fora.mjs, thetab-panel.tslistener that hides the progress bar viatoggleProgress(id, false)never runs.Fix
After creating a new tab in
tab-panel.ts, check whether the document was already loaded (exists indocumentsIndexand is not currently loading). If so, hide the progress bar immediately sincedocuments:loadwon't fire again.Test plan
b.mjsimports froma.mjs(e.g. class inheritance)a.mjsin the Code Editor (progress completes and hides)b.mjsto replacea.mjsin the preview tab (progress completes and hides)a.mjsagain -- verify the progress bar completes and hides (previously stayed visible)