Skip to content

Updates Fail If Elements Are Not Direct Children. #246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rmorshea opened this issue Oct 15, 2020 · 0 comments
Closed

Updates Fail If Elements Are Not Direct Children. #246

rmorshea opened this issue Oct 15, 2020 · 0 comments
Assignees

Comments

@rmorshea
Copy link
Collaborator

This occurs because the path attribute of a LayoutUpdate is determined to be {path-of-parent-element}/children/{index} rather than {path-of-parent-element}/{path-within-element-model}/children/{index}. In other words the position of a child element in the model of its parent is ignored. Thus the following breaks the updates:

@idom.element
def Parent():
    return idom.html.div(idom.html.div(Child()))

@idom.element
def Child():
    state, set_state = idom.hooks.use_state(...)
    ... # define something that will cause an update somehow

Where calling set_state here triggers an update that fails to render in the client.

@rmorshea rmorshea added the bug label Oct 15, 2020
@rmorshea rmorshea self-assigned this Oct 15, 2020
rmorshea added a commit that referenced this issue Oct 15, 2020
The layout was not producing the correct path in its update for element which were
not direct children of eachother.
rmorshea added a commit that referenced this issue Oct 15, 2020
The layout was not producing the correct path in its update for element which were
not direct children of eachother.
rmorshea added a commit that referenced this issue Oct 15, 2020
The layout was not producing the correct path in its update for element which were
not direct children of eachother.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant