Skip to content

Commit c8e7181

Browse files
committed
allow components to return None
1 parent 35e5b99 commit c8e7181

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/idom/core/layout.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,10 @@ def _render_component(
203203
# wrap the model in a fragment (i.e. tagName="") to ensure components have
204204
# a separate node in the model state tree. This could be removed if this
205205
# components are given a node in the tree some other way
206-
raw_model = {"tagName": "", "children": [raw_model]}
206+
raw_model = {
207+
"tagName": "",
208+
"children": [] if raw_model is None else [raw_model],
209+
}
207210

208211
self._render_model(old_state, new_state, raw_model)
209212
except Exception as error:

src/idom/core/proto.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def definition_id(self) -> int:
3939
Usually the :func:`id` of this class or an underlying function.
4040
"""
4141

42-
def render(self) -> VdomDict:
42+
def render(self) -> VdomDict | ComponentType | None:
4343
"""Render the component's :class:`VdomDict`."""
4444

4545

0 commit comments

Comments
 (0)