File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -471,3 +471,27 @@ def Inner(key):
471471 outer_hook .latest .schedule_render ()
472472 await layout .render ()
473473 assert old_inner_hook is inner_hook .latest
474+
475+
476+ async def test_log_warning_on_attempt_to_render_component_not_in_layout (caplog ):
477+ @idom .component
478+ def SomeComponent ():
479+ return idom .html .div ()
480+
481+ component_in_layout = SomeComponent ()
482+ component_not_in_layout = SomeComponent ()
483+
484+ with idom .Layout (component_in_layout ) as layout :
485+ await layout .render ()
486+
487+ # try to update a component instance not in layout
488+ layout .update (component_not_in_layout )
489+ # update this too so the next render doesn't hang forever
490+ layout .update (component_in_layout )
491+
492+ await layout .render ()
493+
494+ assert (
495+ next (iter (caplog .records )).message
496+ == f"Did not render component - { component_not_in_layout } already unmounted or does not belong to this layout"
497+ )
You can’t perform that action at this time.
0 commit comments