@@ -607,29 +607,27 @@ def _(state: BookmarkState):
607607 )
608608 state .values [cell_patch_id_val ] = cell_patch_map
609609
610- updated_data = self ._updated_data ()
611- if updated_data :
610+ if self ._updated_data .is_set ():
612611 # TODO-barret-render.data_frame; Handle restoring updated data
613612 # Related: Restoring Chat UI: https://github.com/posit-dev/py-shiny/issues/1952
614613 raise RuntimeError (
615- "Bookmarking an updated data frame is not supported."
614+ "Bookmarking a manually set data frame is not supported."
616615 )
617616
618- @self ._get_session ().bookmark .on_restore
619- def _ (state : RestoreState ):
620- if state .input [f"{ self .output_id } _cell_selection" ]:
621- self .update_cell_selection (
622- state .input [f"{ self .output_id } _cell_selection" ]
623- )
624- if state .input [f"{ self .output_id } _column_sort" ]:
625- self .update_sort (state .input [f"{ self .output_id } _column_sort" ])
626- if state .input [f"{ self .output_id } _column_filter" ]:
627- self .update_filter (state .input [f"{ self .output_id } _column_filter" ])
628- if state .input [f"{ self .output_id } _cell_selection" ]:
629- self .update_cell_selection (
630- state .input [f"{ self .output_id } _cell_selection" ]
631- )
632- if state .input [f"{ self .output_id } _data_view_rows" ]:
617+ @self ._get_session ().bookmark .on_restored
618+ async def _ (state : RestoreState ):
619+ print ("Available inputs:" , list (state .input .keys ()))
620+ cell_selection_key = f"{ self .output_id } _cell_selection"
621+ column_sort_key = f"{ self .output_id } _column_sort"
622+ column_filter_key = f"{ self .output_id } _column_filter"
623+ if cell_selection_key in state .input :
624+ print ("setting cell selection" , state .input [cell_selection_key ])
625+ await self .update_cell_selection (state .input [cell_selection_key ])
626+ print ("done setting cell selection" )
627+ if column_sort_key in state .input :
628+ await self .update_sort (state .input [column_sort_key ])
629+ if column_filter_key in state .input :
630+ await self .update_filter (state .input [column_filter_key ])
633631
634632 cell_patch_map = state .values .get (bookmark_cell_patch_id (), None )
635633 if cell_patch_map :
0 commit comments