Skip to content

Commit 8a2337b

Browse files
authored
Munge router_data["pathname"] consistently in event processing path (#5873)
Avoid rx.State.router_data consistently marked dirty for all events
1 parent ca1d33a commit 8a2337b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

reflex/app.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1781,16 +1781,16 @@ async def process(
17811781
name=f"reflex_emit_reload|{event.name}|{time.time()}|{event.token}",
17821782
)
17831783
return
1784+
router_data[constants.RouteVar.PATH] = "/" + (
1785+
app.router(path) or "404"
1786+
if (path := router_data.get(constants.RouteVar.PATH))
1787+
else "404"
1788+
).removeprefix("/")
17841789
# re-assign only when the value is different
17851790
if state.router_data != router_data:
17861791
# assignment will recurse into substates and force recalculation of
17871792
# dependent ComputedVar (dynamic route variables)
17881793
state.router_data = router_data
1789-
router_data[constants.RouteVar.PATH] = "/" + (
1790-
app.router(path) or "404"
1791-
if (path := router_data.get(constants.RouteVar.PATH))
1792-
else "404"
1793-
).removeprefix("/")
17941794
state.router = RouterData.from_router_data(router_data)
17951795

17961796
# Preprocess the event.

0 commit comments

Comments
 (0)