Skip to content

Commit b978bf7

Browse files
authored
allow none as a child of components (#5043)
* allow none as a child of components * fix tests * add integration test
1 parent e182afe commit b978bf7

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

reflex/components/component.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def evaluate_style_namespaces(style: ComponentStyle) -> dict:
180180
# Map from component to styling.
181181
ComponentStyle = dict[str | Type[BaseComponent] | Callable | ComponentNamespace, Any]
182182
ComponentChild = types.PrimitiveType | Var | BaseComponent
183-
ComponentChildTypes = (*types.PrimitiveTypes, Var, BaseComponent)
183+
ComponentChildTypes = (*types.PrimitiveTypes, Var, BaseComponent, type(None))
184184

185185

186186
def _satisfies_type_hint(obj: Any, type_hint: Any) -> bool:

tests/integration/test_var_operations.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def memo_comp_nested(int_var2: int, id: str):
6565
@app.add_page
6666
def index():
6767
return rx.vstack(
68+
None, # Testing that None doesn't break everything
6869
rx.el.input(
6970
id="token",
7071
value=VarOperationState.router.session.client_token,

tests/units/components/test_component.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -664,8 +664,6 @@ def test_create_filters_none_props(test_component):
664664
@pytest.mark.parametrize(
665665
"children",
666666
[
667-
((None,),),
668-
("foo", ("bar", (None,))),
669667
({"foo": "bar"},),
670668
],
671669
)

0 commit comments

Comments
 (0)