Skip to content

JupyterLab notebook view of .qmd file shows outdated content due to stale Jupytext rendering #18

@tristanbrown

Description

@tristanbrown

Bug description

When I open a .qmd file in JupyterLab using the notebook interface (via Quarto’s extension), the content shown is from an older version, even though the file on disk has been updated (e.g., via git checkout). The text editor shows the correct version. However, the notebook interface displays stale cells. If I save the file from the notebook view, it overwrites the correct disk version with this outdated content.

I believe this is related to the Jupytext integration used internally to parse .qmd into a notebook format. It seems to cache or restore an outdated in-memory version.

What I’ve Tried:

  • Closing notebook tabs before using git checkout
  • Deleting:
    • .ipynb_checkpoints
    • ~/.jupyter/lab/workspaces/
    • ~/.local/share/jupyter/runtime/
    • Browser data: LocalStorage, IndexedDB, Cache, Service Workers
  • Opening JupyterLab in incognito/private browser sessions
  • Copying the file to a new name (e.g., cp notebook.qmd notebook_copy.qmd) — issue still reproduces

None of these steps resolved the issue.

Steps to reproduce

  1. Create and edit a .qmd file with markdown and code cells.
  2. Commit this file to Git.
  3. Modify and commit a new version.
  4. Use git checkout to switch to the older version (or switch branches).
  5. Open the .qmd file in JupyterLab:
    • In the text editor: the file content is correct (matches disk).
    • In notebook view: the content is outdated (shows old version).
  6. Save the file from the notebook view. This overwrites the correct file with the old content.

Actual behavior

Notebook view shows an older version of the file. Saving from this view reverts the file to outdated content.

Expected behavior

Notebook view should reflect the content on disk, just like the text editor does.

Your environment

  • Quarto version: 1.7.31
  • JupyterLab version: 4.2.5
  • Jupytext version: 1.16.7
  • Browser: Chrome Version 136.0.7103.114 (Official Build) (x86_64)
  • OS: Ubuntu 22.04

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions