Skip to content

Commit

Permalink
fix: Optional chaining to handle undefined title
Browse files Browse the repository at this point in the history
This commit adds safety checks for the `title` property within `reusableBlock`. By using optional chaining, the code now gracefully handles scenarios where `title` might be undefined, preventing a TypeError from being thrown.
  • Loading branch information
Siobhan committed Aug 16, 2023
1 parent 77b25b0 commit abb51ba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/block-editor/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -1978,7 +1978,7 @@ export const getInserterItems = createSelector(
id,
name: 'core/block',
initialAttributes: { ref: reusableBlock.id },
title: reusableBlock.title.raw,
title: reusableBlock.title?.raw,
icon,
category: 'reusable',
keywords: [ 'reusable' ],
Expand Down

0 comments on commit abb51ba

Please sign in to comment.