[WIP] Refactor/gallery to nested image blocks bug fix#34133
Conversation
|
Size Change: +6.79 kB (+1%) Total Size: 1.04 MB
ℹ️ View Unchanged
|
|
@talldan, @ellatrix, @youknowriad do you have any thoughts on the best way to fix this issue? |
|
Yeah, I concur, Seems related to the zombie state issues - #32088 was a recent fix for related problems. |
|
Judging by #32088, the errors are now being logged rather than thrown (before that change this might have caused the editor to crash), and they won't cause any user facing issues. I'm not sure what the right fix would be to prevent the errors, maybe the guards are fine? |
|
@ellatrix given that this issue doesn't cause an editor crash like the useSelect zombie block issue, do you think we should just leave these console errors, or is adding the guards in this PR a good idea? |
talldan
left a comment
There was a problem hiding this comment.
Lets move forwards with this so that potentially confusing errors aren't shown in the console.
It can be easily reverted if another fix comes along.
Description
Fixes: #34098, but this is PR is really just to highlight where the exceptions are being thrown, rather than as a final solution to the problem.
It seems that the issue is that under certain circumstances there is a race condition that causes the
useBlockPropsof an Image block to still run after the Image block it is attached to has been deleted by a call toreplaceInnerBlocks.A better solution would be to prevent the offending calls being made once a block has been deleted, but I haven't found a way to do that yet, so open to ideas on that.
To test
Screenshots
See #34098
Types of changes
Adds optional chaining operators to prevent exceptions if useBlockProps runs after related block deleted.