Fix: `useEditorBlocks` hook always returns an array (#41874)

* fix: useEditorBlocks hook always returns an array

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Luigi Teschio 2023-12-07 14:41:44 +01:00 committed by GitHub
parent 4467715546
commit be79b9864e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -34,10 +34,10 @@ export const useEditorBlocks = (): [
// @ts-ignore Types are not up to date.
const [ blocks, onInput, onChange ]: [
BlockInstance[],
BlockInstance[] | undefined,
ChangeHandler,
ChangeHandler
] = useEntityBlockEditor( 'postType', templateType );
return [ blocks, onInput, onChange ];
return [ blocks ?? [], onInput, onChange ];
};

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Fix: `useEditorBlocks` hook always returns an array.