-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Fix Legacy Widget block in Customizer #31405
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
Conversation
- Prevent crash when Legacy Widget block is added to Customizer. - Show Legacy Widget block variations in Customizer. - Prevent hidden widget types from appearing in Legacy Widget block dropdown.
|
Size Change: -1.58 kB (0%) Total Size: 1.31 MB
ℹ️ View Unchanged
|
456692d to
36f2dcc
Compare
36f2dcc to
f8d2b4d
Compare
talldan
left a comment
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.
Nice work. Tested and this fixes the bugs mentioned in the issue.
There's one thing I spotted. It might be unrelated to this change, but I can't reproduce in trunk (mostly because I can't insert a legacy widget there).
- Install the SiteOrigin bundle plugin
- Open an empty widget area in the customizer
- Add a legacy widget block
- Select SiteOrigin Button option from the dropdown
- Quicky click into the next default block appender (not the + button but the area where the paragraph will be created).
- Editor crashes with the following error
react-dom.82e849f1.js:11237 Uncaught TypeError: Cannot read property 'id' of null
at sidebar-adapter.js:252
at Array.map (<anonymous>)
at SidebarAdapter._updateWidgets (sidebar-adapter.js:251)
at SidebarAdapter.setWidgets (sidebar-adapter.js:275)
at use-sidebar-block-editor.js:186
at basicStateReducer (react-dom.82e849f1.js:15148)
at updateReducer (react-dom.82e849f1.js:15270)
at updateState (react-dom.82e849f1.js:15372)
at Object.useState (react-dom.82e849f1.js:16084)
at useState (react.af754d50.js:1583)
This line of code:
gutenberg/packages/customize-widgets/src/components/sidebar-block-editor/sidebar-adapter.js
Line 238 in 1390bd7
| if ( nextWidget.id && this.getWidget( nextWidget.id ) ) { |
It seems like a race condition, as it only happens when clicking quickly.
|
Good catch! Fixed in 6bab707. |
talldan
left a comment
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.
Works great, nice one!
Description
Fixes #31094.
edit-widgetsandcustomise-widgetsto a newwidgetspackage.How has this been tested?
Checklist:
*.native.jsfiles for terms that need renaming or removal).