Skip to content

Commit 5752f7c

Browse files
committed
Set Renderer._session default as class variable
1 parent 41e85bd commit 5752f7c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

shiny/render/renderer/_renderer.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,12 @@ class Renderer(Generic[IT]):
137137
asynchonously.
138138
"""
139139

140+
# Set _session here because some subclasses of Renderer (e.g. data_frame) set
141+
# self._session before calling super().__init__(). If we were to set
142+
# self._session=None in the __init__ method here, it would overwrite the value from
143+
# the subclass. We avoid that by setting it here.
144+
_session: Session | None = None
145+
140146
def __call__(self, _fn: ValueFn[IT]) -> Self:
141147
"""
142148
Add the value function to the renderer.
@@ -217,7 +223,6 @@ def __init__(
217223
super().__init__()
218224

219225
self._auto_registered: bool = False
220-
self._session: Session | None = None
221226

222227
# Must be done last
223228
if callable(_fn):

0 commit comments

Comments
 (0)