Sfoglia il codice sorgente

fix: allow multiple middleware postprocess update mutations (#4970)

benedikt-bartscher 2 mesi fa
parent
commit
19c2642279
1 ha cambiato i file con 2 aggiunte e 3 eliminazioni
  1. 2 3
      reflex/app_mixins/middleware.py

+ 2 - 3
reflex/app_mixins/middleware.py

@@ -74,6 +74,7 @@ class MiddlewareMixin(AppMixin):
         Returns:
             The state update to return.
         """
+        out = update
         for middleware in self._middlewares:
             if asyncio.iscoroutinefunction(middleware.postprocess):
                 out = await middleware.postprocess(
@@ -89,6 +90,4 @@ class MiddlewareMixin(AppMixin):
                     event=event,
                     update=update,
                 )
-            if out is not None:
-                return out  # pyright: ignore [reportReturnType]
-        return update
+        return out  # pyright: ignore[reportReturnType]