streamlit-nightly 1.35.1.dev20240617__py2.py3-none-any.whl → 1.36.1.dev20240620__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -65,6 +65,12 @@ def rerun() -> NoReturn: # type: ignore[misc]
65
65
 
66
66
  ctx = get_script_run_ctx()
67
67
 
68
+ # TODO: (rerun[scope] project): in order to make it a fragment-scoped rerun, pass
69
+ # the fragment_id_queue to the RerunData object and add the following line:
70
+ # fragment_id_queue=[ctx.current_fragment_id] if scope == "fragment" else []
71
+ # The script_runner RerunException is checking for the fragment_id_queue to decide
72
+ # whether or not to reset the dg_stack.
73
+
68
74
  if ctx and ctx.script_requests:
69
75
  query_string = ctx.query_string
70
76
  page_script_hash = ctx.page_script_hash
@@ -673,11 +673,16 @@ sidebar_dg = DeltaGenerator(root_container=RootContainer.SIDEBAR, parent=main_dg
673
673
  event_dg = DeltaGenerator(root_container=RootContainer.EVENT, parent=main_dg)
674
674
  bottom_dg = DeltaGenerator(root_container=RootContainer.BOTTOM, parent=main_dg)
675
675
 
676
+
676
677
  # The dg_stack tracks the currently active DeltaGenerator, and is pushed to when
677
678
  # a DeltaGenerator is entered via a `with` block. This is implemented as a ContextVar
678
679
  # so that different threads or async tasks can have their own stacks.
680
+ def get_default_dg_stack() -> tuple[DeltaGenerator, ...]:
681
+ return (main_dg,)
682
+
683
+
679
684
  dg_stack: ContextVar[tuple[DeltaGenerator, ...]] = ContextVar(
680
- "dg_stack", default=(main_dg,)
685
+ "dg_stack", default=get_default_dg_stack()
681
686
  )
682
687
 
683
688