wasm: don't panic when removing an already-removed overlay - #335
Merged
Merged
Conversation
WasmDialog's cancel closure is registered both as the cancel button's onclick and the input's native `cancel` listener, and it is forgotten rather than dropped after use, so it can run twice for a single dialog. The second invocation's remove_child call panics on NotFoundError, which is unrecoverable on wasm32-unknown-unknown and kills the whole instance. Removing a node that is already gone is exactly the outcome the caller wants, so stop unwrapping the result. Fixes PolyMeilex#334 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #334.
The cancel closure in
WasmDialog::showis registered as both the cancel button'sonclickand the input's nativecancellistener, and it'sforgetten rather than dropped, so it can run twice for one dialog. The secondremove_childcall panics withNotFoundError, which is unrecoverable onwasm32-unknown-unknownand kills the whole instance.As confirmed in the issue thread, this switches to the simplest fix: stop unwrapping the removal, since removing an already-gone node is the outcome the caller wants anyway.
🤖 Generated with Claude Code