-
-
Notifications
You must be signed in to change notification settings - Fork 332
Closed
Labels
priority-1-highShould be resolved ASAP.Should be resolved ASAP.
Description
Current Situation
Currently changing the key of a parent element does not cause the state of child components to get refreshed:
from idom import component, html, run, hooks
from random import random
@component
def Demo():
h = hooks.current_hook()
return html.div(
html.button({"onClick": lambda event: h.schedule_render()}, "re-render"),
HasState(),
key=str(random()),
)
@component
def HasState():
state = hooks.use_state(random)[0]
return html.p(state)
run(Demo)Every time the button is clicked HasState should display a new random value because they key of its parent div is random, and thus its identity should always change. This does not happen though.
Only by placing the random key in HasState directly do we get the expected behavior.
Proposed Actions
Debug and fix.
Work Items
No response
Metadata
Metadata
Assignees
Labels
priority-1-highShould be resolved ASAP.Should be resolved ASAP.