Skip to content

Commit 9faa927

Browse files
committed
fix: add additional error handling
1 parent ba6cac8 commit 9faa927

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/hooks/use-preset-controls.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,12 @@ export const usePresetControls = property => {
7373
// are not explicitly set to `false` in theme.json v3.
7474
if ( hasThemePresets && wpDefaultPresets && defaultSizesEnabled !== false ) {
7575
// Create a set for removing duplicates.
76-
const existingSlugs = new Set( _themePresets.map( item => item.slug ) )
76+
const existingSlugs = new Set()
77+
_themePresets.forEach( item => {
78+
if ( item && typeof item.slug === 'string' ) {
79+
existingSlugs.add( item.slug )
80+
}
81+
} )
7782

7883
themePresets = [
7984
..._themePresets,

0 commit comments

Comments
 (0)