Repository navigation
DataViews: Duplicating an uncategorized pattern causes a JavaScript error #66888
Description
Description
Originally reported on Trac: https://core.trac.wordpress.org/ticket/62367
crash when duplicating "uncategorized" patterns
condition: Fresh install of wordpress 6.7.RC4. Default 2025 theme.
Recreate problem:
Navigate "appearance" -> "editor" -> "patterns" -> "uncategorized"
select one of the three patterns -> hamburger -> "duplicate"
problem occurs
symptom: black screen - stall -- needs browser refresh to restore.
also throws javascript error;
Uncaught TypeError: e.categories is undefined ... patterns.min.js:2:6657
I am able to reproduce this problem on WordPress 6.7-RC4-59375 with any theme that registers patterns without the categories parameter.
I tested this by removing the categories parameter from a pattern in Twenty Twenty-One, which is a classic theme that registers patterns with the PHP function, and in Twenty Twenty-Four, a block theme that registers patterns by using the patterns folder.
With and without Gutenberg trunk active.
react-dom.min.js?ver=18:1 Uncaught TypeError: Cannot read properties of undefined (reading 'includes')
at duplicate-pattern-modal.js:20:24
at Array.filter (<anonymous>)
at L (duplicate-pattern-modal.js:19:6)
at U (duplicate-pattern-modal.js:48:22)
at RenderModal (duplicate-pattern.tsx:26:27)
at gt (react-dom.min.js?ver=18:1:45667)
at js (react-dom.min.js?ver=18:1:120123)
at Sl (react-dom.min.js?ver=18:1:88331)
at kl (react-dom.min.js?ver=18:1:88259)
at bl (react-dom.min.js?ver=18:1:88122)
The categories parameter is not required for registering a pattern, and this should not cause an error.
https://developer.wordpress.org/block-editor/reference-guides/block-api/block-patterns/#register_block_pattern
Step-by-step reproduction instructions
Navigate "appearance" -> "editor" -> "patterns" -> "uncategorized"
select one of the three patterns -> hamburger -> "duplicate"
problem occurs
symptom: black screen - stall -- needs browser refresh to restore.
also throws javascript error;
Uncaught TypeError: e.categories is undefined ... patterns.min.js:2:6657
Screenshots, screen recording, code snippet
No response
Environment info
WordPress 6.7-RC4-59375
Please confirm that you have searched existing issues in the repo.
- Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
- Yes
Please confirm which theme type you used for testing.
- Block
- Classic
- Hybrid (e.g. classic with theme.json)
- Not sure
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fields✅ Done
Activity
carolinan commentedon Nov 10, 2024
Also reproduced on WordPress 6.6.2.
getdave commentedon Nov 11, 2024
Thanks for reporting.
Confidence check @ndiego for 6.7.1 🙏
getdave commentedon Nov 12, 2024
Thanks for the quick fix! Let's get this into 6.7.1. Once WP 6.7 is launched today we can simply add the
Backport to WP 6.7 Beta/RClabel and it should auto-cherry pick.