Skip to content

Commit 6a50d56

Browse files
committed
check component has model state before render
1 parent 417b687 commit 6a50d56

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/idom/core/layout.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,13 @@ async def dispatch(self, event: LayoutEvent) -> None:
113113

114114
async def render(self) -> LayoutUpdate:
115115
while True:
116-
return self._create_layout_update(await self._rendering_queue.get())
116+
component = await self._rendering_queue.get()
117+
if id(component) in self._model_state_by_component_id:
118+
return self._create_layout_update(component)
119+
else:
120+
logger.info(
121+
f"Did not render component - {component} already unmounted or does not belong to this layout"
122+
)
117123

118124
if IDOM_DEBUG_MODE.get():
119125
# If in debug mode inject a function that ensures all returned updates

0 commit comments

Comments
 (0)