Skip to content

Event Occurs After Handler is Deleted #19

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 Apr 20, 2019 · 0 comments
Closed

Event Occurs After Handler is Deleted #19

rmorshea opened this issue Apr 20, 2019 · 0 comments

Comments

@rmorshea
Copy link
Collaborator

Consider a case where a button click causes that button to be re-rendered. In this scenario, after the first click the backend will begin work to render again and eventually will delete state for the original button element. If shortly after the first button click a user clicks again it is possible that the button in the view and the button model in the backend are not the same. The event produced by this last click will result in an error because the element that would normally have handled it has already been deleted.

In particular we get a key error here:

https://github.com/rmorshea/idom/blob/b21f8e8361ced41508fb80afab4d5efe69c423fe/src/py/idom/layout.py#L60

rmorshea added a commit that referenced this issue Apr 23, 2019
It is possible for events from the client to refer to elements
on the backend that have already been deleted. This is because
the frontend has not been sent the newly computed DOM model by
the time the event is produced - thus the target of the event
is stale.

In this case we now choose to ignore the event because the element
has been deleted.
@rmorshea rmorshea reopened this Apr 23, 2019
rmorshea added a commit that referenced this issue Apr 23, 2019
rmorshea added a commit that referenced this issue Apr 23, 2019
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