/ concept-collection / jupyterlite-numbl-kernel
Sign in
concept-collection / jupyterlite-numbl-kernel
Demo: use in-memory JupyterLite storage so reloads show fresh content
JupyterLite copies notebooks into IndexedDB on first visit and that local copy wins over redeployed files, so returning visitors saw stale demo content. Opt into memoryStorageDriver for contents/settings/workspaces so every reload re-seeds the latest deployment. numbl's own mip package cache is a separate IndexedDB store and still persists.
Jeremy Magland <jmagland@flatironinstitute.org> committed commit 8befa625ee96 parent 6b31a9a Browse files
2 changed files+32−1
README.mdmodified+27−0View file
@@ -57,6 +57,33 @@ The `demo/` directory in this repo contains the demo site sources
5757 (notebooks + requirements); `.github/workflows/deploy.yml` builds and
5858 deploys it to GitHub Pages.
5959
60+### Always-fresh content (demo choice)
61+
62+By default JupyterLite copies notebooks into the browser's IndexedDB on
63+first visit, and that local copy then wins over the deployed files **even
64+after a redeploy** — so returning visitors keep seeing stale content. Since
65+this is a demo, `demo/jupyter-lite.json` opts into JupyterLite's in-memory
66+storage so every page reload re-seeds the latest deployed notebooks:
67+
68+```json
69+{
70+ "jupyter-config-data": {
71+ "enableMemoryStorage": true,
72+ "contentsStorageDrivers": ["memoryStorageDriver"],
73+ "settingsStorageDrivers": ["memoryStorageDriver"],
74+ "workspacesStorageDrivers": ["memoryStorageDriver"]
75+ }
76+}
77+```
78+
79+The trade-off is that a visitor's edits live only for the session and are
80+discarded on reload. For a real deployment where users should keep their
81+work, omit these keys (the default persistent storage) and bump
82+`contentsStorageName` when you want to force-refresh shipped content.
83+numbl's own package cache (installed via `mip`) lives in a separate
84+IndexedDB store and is unaffected, so `mip`-installed packages still
85+persist across reloads.
86+
6087 ## Limitations (proof of concept)
6188
6289 - **No interrupt**: a runaway cell can only be stopped by restarting the
demo/jupyter-lite.jsonmodified+5−1View file
@@ -2,6 +2,10 @@
22 "jupyter-lite-schema-version": 0,
33 "jupyter-config-data": {
44 "appName": "numbl JupyterLite demo",
5- "defaultKernelName": "numbl"
5+ "defaultKernelName": "numbl",
6+ "enableMemoryStorage": true,
7+ "contentsStorageDrivers": ["memoryStorageDriver"],
8+ "settingsStorageDrivers": ["memoryStorageDriver"],
9+ "workspacesStorageDrivers": ["memoryStorageDriver"]
610 }
711 }
moveopenescclose