Skip to content

fix: use mount_config.code and filename as fallback in WASM mode#8161

Merged
mscolnick merged 2 commits intomarimo-team:mainfrom
ffmiruz:fix-8026-wasm-mount-config-code
Feb 10, 2026
Merged

fix: use mount_config.code and filename as fallback in WASM mode#8161
mscolnick merged 2 commits intomarimo-team:mainfrom
ffmiruz:fix-8026-wasm-mount-config-code

Conversation

@ffmiruz
Copy link
Contributor

@ffmiruz ffmiruz commented Feb 6, 2026

When embedding marimo in WASM mode without a marimo-code element, the mount config's code and filename options are now used as fallbacks.

Code fallback priority:

  1. mount_config.code
  2. marimo-code element
  3. URL params
  4. local storage
  5. remote default
  6. empty notebook

Filename fallback priority:

  1. mount_config.filename
  2. URL param (?filename=...)

Fixes #8026

@vercel
Copy link

vercel bot commented Feb 6, 2026

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

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment Feb 10, 2026 4:09pm

Request Review

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@ffmiruz
Copy link
Contributor Author

ffmiruz commented Feb 6, 2026

I have read the CLA Document and I hereby sign the CLA

// Read-only: mount config code is set externally
},
readFile() {
return mountConfigCode;
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can just read directly from the store here? And then can remove the setMountConfig function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Redo to not hold a copy of config code somewhere else.

// Prefer local storage (persists user edits), then mount config code,
// then remote default, then empty
localStorageFileStore,
mountConfigFileStore,
Copy link
Contributor

Choose a reason for hiding this comment

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

actually taking a step back, shouldn't this get picked up by domElementFileStore in notebookFileStore?

Copy link
Contributor

Choose a reason for hiding this comment

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

oh, maybe mount config is being called without using <marimo-code/>?

do we want this to take precedence over local-storage? then maybe this should be in notebookFileStore (not a fallback)?

Copy link
Contributor

Choose a reason for hiding this comment

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

it probably should go:

  1. mountConfig (because you make load a page once but mount a few times via naivation
  2. domElement (one per page)
  3. url

thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm how i see it is, mount code is "init". And then if domELement is set, there is intention to override it. Same goes for url.
About localStorage, yea I'm a bit fuzzy. My thinking is, localStorage is to survive reload but if it always behind mount code then it is never useful, no? idk

But yea, mount code, domELement, url in some order inside notebookFileStore is probably the solution here.

Copy link
Contributor

Choose a reason for hiding this comment

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

@ffmiruz, ping me when you make the change. i think we are on the same page

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you confirm the order

Copy link
Contributor

@mscolnick mscolnick Feb 10, 2026

Choose a reason for hiding this comment

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

mount code, domELement, url in notebookFileStore, seems correct to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@mscolnick mscolnick added the bug Something isn't working label Feb 10, 2026
When embedding marimo in WASM mode, the mount config's code and filename
options are used.

Code priority:
1. mount_config.code
2. <marimo-code> element
3. URL params
4. local storage
5. remote default
6. empty notebook

Filename priority:
1. mount_config.filename
2. URL param (?filename=...)

Fixes marimo-team#8026
@ffmiruz ffmiruz requested a review from mscolnick February 10, 2026 16:10
@mscolnick mscolnick merged commit 00690fd into marimo-team:main Feb 10, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

2 participants