Browse Source

Ensure rx.match gets memoized to avoid excessive re-rendering (#3552)

Masen Furer 11 tháng trước cách đây
mục cha
commit
0314d19e7e
1 tập tin đã thay đổi với 3 bổ sung0 xóa
  1. 3 0
      reflex/components/component.py

+ 3 - 0
reflex/components/component.py

@@ -2038,6 +2038,7 @@ class StatefulComponent(BaseComponent):
         from reflex.components.base.bare import Bare
         from reflex.components.core.cond import Cond
         from reflex.components.core.foreach import Foreach
+        from reflex.components.core.match import Match
 
         if isinstance(child, Bare):
             return child.contents
@@ -2045,6 +2046,8 @@ class StatefulComponent(BaseComponent):
             return child.cond
         if isinstance(child, Foreach):
             return child.iterable
+        if isinstance(child, Match):
+            return child.cond
         return child
 
     @classmethod