Fix navigation menu error when menus are not yet fetched#39151
Merged
Conversation
12 tasks
|
Size Change: +2 B (0%) Total Size: 1.15 MB
ℹ️ View Unchanged
|
kevin940726
approved these changes
Mar 2, 2022
andrewserong
approved these changes
Mar 2, 2022
Contributor
andrewserong
left a comment
There was a problem hiding this comment.
Nice simple fix @talldan!
Confirmed that the error appears before on trunk, and that after, selecting the block while it's loading does not throw the error:
| Before | After |
|---|---|
![]() |
![]() |
LGTM!
ramonjd
approved these changes
Mar 2, 2022
Member
ramonjd
left a comment
There was a problem hiding this comment.
LGTM
On trunk I get the following JS error when selecting the Navigation:
navigation-menu-selector.js:46 Uncaught TypeError: Cannot read properties of null (reading 'filter')
at NavigationMenuSelector (navigation-menu-selector.js:46:53)
at renderWithHooks (react-dom.860550b4.js:15015:20)
at mountIndeterminateComponent (react-dom.860550b4.js:17841:15)
at beginWork (react-dom.860550b4.js:19079:18)
at HTMLUnknownElement.callCallback (react-dom.860550b4.js:3942:16)
at Object.invokeGuardedCallbackDev (react-dom.860550b4.js:3991:18)
at invokeGuardedCallback (react-dom.860550b4.js:4053:33)
at beginWork$1 (react-dom.860550b4.js:23994:9)
at performUnitOfWork (react-dom.860550b4.js:22806:14)
at workLoopSync (react-dom.860550b4.js:22737:7)
When refreshing using this patch, I see no errors and I can edit the Navigation Block as expected:

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 is a little bug that was noticed in #39087.
I think this will be fixed in #38907, but it'd be good to get this small fix in first as that one is a slightly bigger change and may not make the cut for the next plugin release. This one can be cherry picked into the 12.7 release
Testing Instructions
In this branch: Everything works ok
In
trunk: The block throws an errorQuick explanation - this bug only happens while the menus are still being fetched, the render function tries to call
filteronnull.Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist:
*.native.jsfiles for terms that need renaming or removal).