Skip to content

Commit

Permalink
ensure blocks are present before processing
Browse files Browse the repository at this point in the history
  • Loading branch information
psorensen committed Feb 5, 2024
1 parent 72a69f0 commit 8a05611
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions assets/js/admin/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ import {select, subscribe} from '@wordpress/data';
subscribe(() => {
if (editorStore.isSavingPost()) {
const changes = editorStore.getPostEdits();
// maske sure we have blocks to process
if (!Array.isArray(changes.blocks) || !changes.blocks.length) {
return;
}
for (const changedBlock of changes.blocks) {
const blockName = changedBlock?.name ?? '';
const innerBlocks = changedBlock?.innerBlocks ?? [];
Expand Down

0 comments on commit 8a05611

Please sign in to comment.