Skip to content

Commit fe0bc5b

Browse files
committed
Move _registration_context_middleware to top of asgi stack
And don't register it as middleware, because it's not middleware technically (even though it worked the way it was).
1 parent 5b056ad commit fe0bc5b

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

reflex/app.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -652,8 +652,6 @@ def __call__(self) -> ASGIApp:
652652
raise ValueError(msg)
653653

654654
asgi_app = self._api
655-
# Make sure the RegistrationContext is attached.
656-
asgi_app.add_middleware(self._registration_context_middleware)
657655

658656
if environment.REFLEX_MOUNT_FRONTEND_COMPILED_APP.get():
659657
asgi_app.mount(
@@ -687,8 +685,8 @@ def __call__(self) -> ASGIApp:
687685
top_asgi_app = Starlette(lifespan=self._run_lifespan_tasks)
688686
top_asgi_app.mount("", asgi_app)
689687
App._add_cors(top_asgi_app)
690-
691-
return top_asgi_app
688+
# Make sure the RegistrationContext is attached.
689+
return self._registration_context_middleware(top_asgi_app)
692690

693691
def _add_default_endpoints(self):
694692
"""Add default api endpoints (ping)."""

0 commit comments

Comments
 (0)