fix: use mount_config.code and filename as fallback in WASM mode#8161
fix: use mount_config.code and filename as fallback in WASM mode#8161mscolnick merged 2 commits intomarimo-team:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
frontend/src/core/wasm/store.ts
Outdated
| // Read-only: mount config code is set externally | ||
| }, | ||
| readFile() { | ||
| return mountConfigCode; |
There was a problem hiding this comment.
Maybe we can just read directly from the store here? And then can remove the setMountConfig function?
There was a problem hiding this comment.
Done. Redo to not hold a copy of config code somewhere else.
deb660b to
33d312f
Compare
frontend/src/core/wasm/store.ts
Outdated
| // Prefer local storage (persists user edits), then mount config code, | ||
| // then remote default, then empty | ||
| localStorageFileStore, | ||
| mountConfigFileStore, |
There was a problem hiding this comment.
actually taking a step back, shouldn't this get picked up by domElementFileStore in notebookFileStore?
There was a problem hiding this comment.
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)?
There was a problem hiding this comment.
it probably should go:
mountConfig(because you make load a page once but mount a few times via naivationdomElement(one per page)url
thoughts?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
@ffmiruz, ping me when you make the change. i think we are on the same page
There was a problem hiding this comment.
Can you confirm the order
There was a problem hiding this comment.
mount code, domELement, url in notebookFileStore, seems correct to me.
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
32e2c3c to
11d6842
Compare
for more information, see https://pre-commit.ci
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:
Filename fallback priority:
Fixes #8026