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

This commit is contained in:
Masen Furer 2024-06-25 06:20:04 -07:00 committed by GitHub
parent 6947ec3a28
commit 0314d19e7e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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