Only update state if we have a valid reference#24496
Merged
talldan merged 3 commits intoWordPress:masterfrom Aug 20, 2020
Merged
Only update state if we have a valid reference#24496talldan merged 3 commits intoWordPress:masterfrom
talldan merged 3 commits intoWordPress:masterfrom
Conversation
added 2 commits
August 16, 2020 19:21
…gutenberg into fix/block-toolbar-unmount
talldan
approved these changes
Aug 20, 2020
Contributor
talldan
left a comment
There was a problem hiding this comment.
I had some trouble reproducing the original issue, but having said that I can see how it could logically happen, and this fix doesn't cause any issues, so it seems good to have the added guard.
Thanks for working on this!
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.
Description
This should resolve #24495.
If a block is a child of a group block, it will have a parent selector that is shown when we hover over the block switcher and hidden when we move from it. The function to hide this is called in a setTimeout callback. If the block is unmounted, we still attempt to hide the parent selector via the setTimeout callback. By the time the callback gets executed, it is possible that the component would have already been unmounted.
How has this been tested?
Types of changes
Bug fix
Checklist: