|
@@ -352,7 +352,7 @@ class Component(BaseComponent, ABC):
|
|
|
**{
|
|
|
prop: Var.create(
|
|
|
kwargs[prop],
|
|
|
- _var_is_string=False,
|
|
|
+ _var_is_string=False if isinstance(kwargs[prop], str) else None,
|
|
|
)
|
|
|
for prop in self.get_initial_props()
|
|
|
if prop in kwargs
|
|
@@ -400,7 +400,10 @@ class Component(BaseComponent, ABC):
|
|
|
passed_types = None
|
|
|
try:
|
|
|
# Try to create a var from the value.
|
|
|
- kwargs[key] = Var.create(value, _var_is_string=False)
|
|
|
+ kwargs[key] = Var.create(
|
|
|
+ value,
|
|
|
+ _var_is_string=False if isinstance(value, str) else None,
|
|
|
+ )
|
|
|
|
|
|
# Check that the var type is not None.
|
|
|
if kwargs[key] is None:
|
|
@@ -425,7 +428,9 @@ class Component(BaseComponent, ABC):
|
|
|
if types.is_union(passed_type):
|
|
|
# We need to check all possible types in the union.
|
|
|
passed_types = (
|
|
|
- arg for arg in passed_type.__args__ if arg is not type(None)
|
|
|
+ arg
|
|
|
+ for arg in passed_type.__args__ # type: ignore
|
|
|
+ if arg is not type(None)
|
|
|
)
|
|
|
if (
|
|
|
# If the passed var is a union, check if all possible types are valid.
|
|
@@ -447,7 +452,8 @@ class Component(BaseComponent, ABC):
|
|
|
if key in component_specific_triggers:
|
|
|
# Temporarily disable full control for event triggers.
|
|
|
kwargs["event_triggers"][key] = self._create_event_chain(
|
|
|
- value=value, args_spec=component_specific_triggers[key]
|
|
|
+ value=value, # type: ignore
|
|
|
+ args_spec=component_specific_triggers[key],
|
|
|
)
|
|
|
|
|
|
# Remove any keys that were added as events.
|