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