-
Notifications
You must be signed in to change notification settings - Fork 4.1k
✨ [Observable] Make observable safe to remove handler while firing. #37887
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
Merged
mszylkowski
merged 22 commits into
ampproject:main
from
mszylkowski:observer_removeafter
Mar 17, 2022
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
6aabe91
Added tasts
mszylkowski dc1fa87
Undo
mszylkowski d707e5b
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski 0e3df75
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski a3f7bd0
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski 8c5119c
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski 77f8435
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski 16e712e
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski 8088eb7
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski 3858b2a
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski e12d2f6
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski 2a29105
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski a5b781f
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski b8006ee
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski b570e86
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski 974e219
Make observable work with removing items while firing
mszylkowski e0a87a1
Using set for removing
mszylkowski 5dc4e93
Remove previous code
mszylkowski c5d9d63
Added iterating depth
mszylkowski e844875
Added test to check iterations of handler removal
mszylkowski 09809c6
Simplified impl and cleaned unused tests
mszylkowski be19f25
Added comment
mszylkowski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Make observable work with removing items while firing
- Loading branch information
commit 974e219dc69f557064b65a3b18ce414186fcdfc1
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: this isn't capable of reentry, but it may never come up in practice. We could store a local
wasIteratingBefore, and only cleanup if!wasIteratingBeforeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mind explaining more? Is it that it won't work if it fires the observer again inside a fire handler?