File tree 1 file changed +23
-0
lines changed
src/py/reactpy/tests/test_core
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -1320,3 +1320,26 @@ def Child():
1320
1320
{"tagName" : "div" , "children" : [{"tagName" : "" , "children" : []}]}
1321
1321
],
1322
1322
}
1323
+
1324
+
1325
+ async def test_conditionally_render_none_does_not_trigger_state_change_in_siblings ():
1326
+ toggle_condition = Ref ()
1327
+ effect_run_count = Ref (0 )
1328
+
1329
+ @component
1330
+ def Root ():
1331
+ condition , toggle_condition .current = use_toggle (True )
1332
+ return html .div ("text" if condition else None , Child ())
1333
+
1334
+ @component
1335
+ def Child ():
1336
+ @reactpy .use_effect
1337
+ def effect ():
1338
+ effect_run_count .current += 1
1339
+
1340
+ async with layout_runner (Layout (Root ())) as runner :
1341
+ await runner .render ()
1342
+ poll (lambda : effect_run_count .current ).until_equals (1 )
1343
+ toggle_condition .current ()
1344
+ await runner .render ()
1345
+ assert effect_run_count .current == 1
You can’t perform that action at this time.
0 commit comments