@@ -319,30 +319,7 @@ def make_app():
319319 if user_id :
320320 _registry [user_id ] = {"mgr" : mgr , "ui" : ui , "template" : tmpl }
321321
322- sel = saved .get ("selection" , [])
323-
324322 def _on_load ():
325- # Replay saved selection → re-trigger Plot action. Only
326- # meaningful after a server restart when diskcache had a saved
327- # selection; fresh users have no saved state.
328- if sel and hasattr (ui , "display_table" ) and hasattr (ui , "_registered_actions" ):
329- plot_cb = next (
330- (
331- a ["callback" ]
332- for a in ui ._registered_actions
333- if a .get ("name" ) == "Plot"
334- ),
335- None ,
336- )
337- if plot_cb :
338- n_rows = len (ui .display_table .value ) if ui .display_table .value is not None else 0
339- valid_sel = [i for i in sel if i < n_rows ]
340- if valid_sel :
341- ui .display_table .selection = valid_sel
342- pn .state .curdoc .add_next_tick_callback (
343- lambda : plot_cb (None , ui )
344- )
345-
346323 # Wire live-persistence watchers so any param change is
347324 # immediately flushed to diskcache (only when persist=True).
348325 if persist :
@@ -690,31 +667,11 @@ def make_app():
690667 if user_id :
691668 _registry [user_id ] = {"mgr" : mgr , "ui" : ui , "template" : tmpl }
692669
693- sel = saved .get ("selection" , [])
694-
695670 def _on_load ():
696671 # Capture the running Tornado IOLoop so the pywebview GUI thread can
697672 # schedule confirmation callbacks via IOLoop.add_callback (thread-safe).
698673 _app_state ["ioloop" ] = _tornado_ioloop .IOLoop .current ()
699674
700- if sel and hasattr (ui , "display_table" ) and hasattr (ui , "_registered_actions" ):
701- plot_cb = next (
702- (
703- a ["callback" ]
704- for a in ui ._registered_actions
705- if a .get ("name" ) == "Plot"
706- ),
707- None ,
708- )
709- if plot_cb :
710- n_rows = len (ui .display_table .value ) if ui .display_table .value is not None else 0
711- valid_sel = [i for i in sel if i < n_rows ]
712- if valid_sel :
713- ui .display_table .selection = valid_sel
714- pn .state .curdoc .add_next_tick_callback (
715- lambda : plot_cb (None , ui )
716- )
717-
718675 if persist :
719676 def _do_save (event = None ):
720677 if user_id :
0 commit comments