Skip to content

Commit 8acb41b

Browse files
authored
Disable server-side bookmarking for py-shiny (#206)
1 parent 8379b1c commit 8acb41b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/hooks/usePyodide.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,24 @@ async def _start_app(app_name, scope = _shiny_app_registry, dev_mode = False):
377377
import os
378378
import sys
379379
import importlib
380+
import shiny
380381
import shiny.express
381382
from pathlib import Path
382383
384+
if (
385+
hasattr(shiny, "bookmark")
386+
and hasattr(shiny.bookmark, "set_global_save_dir_fn")
387+
and hasattr(shiny.bookmark, "set_global_restore_dir_fn")
388+
):
389+
390+
def not_configured(id):
391+
raise NotImplementedError(
392+
"shinylive is not configured to save sessions to disk."
393+
)
394+
395+
shiny.bookmark.set_global_save_dir_fn(not_configured)
396+
shiny.bookmark.set_global_restore_dir_fn(not_configured)
397+
383398
app_dir = f"/home/pyodide/{app_name}"
384399
sys.path.insert(0, app_dir)
385400

0 commit comments

Comments
 (0)