use infallible guy
This commit is contained in:
parent
713f907bf0
commit
1aa728ee4c
@ -10,7 +10,7 @@ from reflex.components.tags import CondTag, Tag
|
|||||||
from reflex.constants import Dirs
|
from reflex.constants import Dirs
|
||||||
from reflex.style import LIGHT_COLOR_MODE, resolved_color_mode
|
from reflex.style import LIGHT_COLOR_MODE, resolved_color_mode
|
||||||
from reflex.utils.imports import ImportDict, ImportVar
|
from reflex.utils.imports import ImportDict, ImportVar
|
||||||
from reflex.utils.types import safe_issubclass
|
from reflex.utils.types import infallible_issubclass
|
||||||
from reflex.vars import VarData
|
from reflex.vars import VarData
|
||||||
from reflex.vars.base import LiteralVar, ReflexCallable, Var
|
from reflex.vars.base import LiteralVar, ReflexCallable, Var
|
||||||
from reflex.vars.function import ArgsFunctionOperation
|
from reflex.vars.function import ArgsFunctionOperation
|
||||||
@ -143,7 +143,7 @@ def cond(condition: Any, c1: Any, c2: Any = None) -> Component | Var:
|
|||||||
|
|
||||||
# If the first component is a component, create a Fragment if the second component is not set.
|
# If the first component is a component, create a Fragment if the second component is not set.
|
||||||
if isinstance(c1, BaseComponent) or (
|
if isinstance(c1, BaseComponent) or (
|
||||||
isinstance(c1, Var) and safe_issubclass(c1._var_type, BaseComponent)
|
isinstance(c1, Var) and infallible_issubclass(c1._var_type, BaseComponent)
|
||||||
):
|
):
|
||||||
c2 = c2 if c2 is not None else Fragment.create()
|
c2 = c2 if c2 is not None else Fragment.create()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user