fix: Removing router_data from StateUpdate.
This commit is contained in:
parent
db4c73a027
commit
351e5a0250
@ -1244,17 +1244,21 @@ async def process(
|
||||
from reflex.utils import telemetry
|
||||
|
||||
try:
|
||||
# Add request data to the state.
|
||||
router_data = event.router_data
|
||||
router_data.update(
|
||||
{
|
||||
constants.RouteVar.QUERY: format.format_query_params(event.router_data),
|
||||
constants.RouteVar.CLIENT_TOKEN: event.token,
|
||||
constants.RouteVar.SESSION_ID: sid,
|
||||
constants.RouteVar.HEADERS: headers,
|
||||
constants.RouteVar.CLIENT_IP: client_ip,
|
||||
}
|
||||
)
|
||||
router_data = {}
|
||||
if event.router_data:
|
||||
# Add request data to the state.
|
||||
router_data = event.router_data
|
||||
router_data.update(
|
||||
{
|
||||
constants.RouteVar.QUERY: format.format_query_params(
|
||||
event.router_data
|
||||
),
|
||||
constants.RouteVar.CLIENT_TOKEN: event.token,
|
||||
constants.RouteVar.SESSION_ID: sid,
|
||||
constants.RouteVar.HEADERS: headers,
|
||||
constants.RouteVar.CLIENT_IP: client_ip,
|
||||
}
|
||||
)
|
||||
# Get the state for the session exclusively.
|
||||
async with app.state_manager.modify_state(event.substate_token) as state:
|
||||
# re-assign only when the value is different
|
||||
|
@ -1467,9 +1467,9 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
|
||||
if cls._scope is not None:
|
||||
scope = None
|
||||
if isinstance(cls._scope, str):
|
||||
scope = cls._scope
|
||||
scope = f"static{cls._scope}"
|
||||
else:
|
||||
scope = getattr(self, cls._scope._var_name)
|
||||
scope = f"shared{getattr(self, cls._scope._var_name)}"
|
||||
|
||||
token = scope
|
||||
|
||||
@ -1690,6 +1690,9 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
|
||||
.union(self._always_dirty_computed_vars)
|
||||
)
|
||||
|
||||
if len(self.scopes_and_subscopes()) > 1 and "router" in delta_vars:
|
||||
delta_vars.remove("router")
|
||||
|
||||
subdelta = {
|
||||
prop: getattr(self, prop)
|
||||
for prop in delta_vars
|
||||
|
Loading…
Reference in New Issue
Block a user