From 4ef2ba779cea5d37f332e99908f5143602ae03eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Brand=C3=A9ho?= Date: Wed, 8 Feb 2023 06:53:04 +0100 Subject: [PATCH] Add router_data in substates (#474) --- pynecone/app.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pynecone/app.py b/pynecone/app.py index 239a82262..f5ac0263b 100644 --- a/pynecone/app.py +++ b/pynecone/app.py @@ -337,7 +337,11 @@ async def process(app: App, event: Event) -> StateUpdate: # Get the state for the session. state = app.state_manager.get_state(event.token) + # pass router_data to the state of the App state.router_data = event.router_data + # also pass router_data to all substates + for _, substate in state.substates.items(): + substate.router_data = event.router_data state.router_data[constants.RouteVar.CLIENT_TOKEN] = event.token # Preprocess the event.