Skip to content

[backport] Fix transient .quarto_ipynb files accumulating during preview#14288

Merged
cderv merged 2 commits intov1.9from
backport/issue-14281
Mar 31, 2026
Merged

[backport] Fix transient .quarto_ipynb files accumulating during preview#14288
cderv merged 2 commits intov1.9from
backport/issue-14281

Conversation

@cderv
Copy link
Copy Markdown
Collaborator

@cderv cderv commented Mar 31, 2026

Important

Backport of the invalidateForFile() fix from #14287.

When previewing a .qmd with Jupyter execution, transient .quarto_ipynb files accumulate on each re-render (_1, _2, etc.) and persist on disk even with keep-ipynb: false. Regression introduced in v1.9 by #13804.

renderForPreview() deletes the cache entry before each re-render but does not delete the old transient notebook file from disk. The collision-avoidance loop in target() sees the existing file and creates a numbered variant.

The fix adds invalidateForFile() to FileInformationCacheMap which deletes the transient file before removing the cache entry.

The structural fix (passing ProjectContext from cmd.ts to preview()) is not backported — it is an improvement that eliminates a pre-existing double-context creation, not a v1.9 regression.

Fixes #14281

cderv added 2 commits March 31, 2026 10:36
Preview re-renders delete the fileInformationCache entry to pick up
file changes, but this loses track of the transient .quarto_ipynb path.
The collision-avoidance loop in jupyter.ts target() then sees the old
file on disk and creates numbered variants (_1, _2, etc.) that are
never cleaned up until preview exits.

Add invalidateForFile() to FileInformationCacheMap that cleans up any
transient notebook file from disk before removing the cache entry.
Replace the bare delete() call in renderForPreview() with this method.

Fixes #14281
@cderv cderv merged commit c829202 into v1.9 Mar 31, 2026
85 of 86 checks passed
@cderv cderv deleted the backport/issue-14281 branch March 31, 2026 13:47
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.

1 participant