Skip to content

Commit

Permalink
Edit Post: Fix the 'usePaddingAppender' error (#61500)
Browse files Browse the repository at this point in the history
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: ellatrix <ellatrix@git.wordpress.org>
  • Loading branch information
3 people authored May 9, 2024
1 parent 4866c3b commit f2503b1
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function usePaddingAppender() {
return;
}

// only handle clicks under the last child
// Only handle clicks under the last child.
const lastChild = node.lastElementChild;
if ( ! lastChild ) {
return;
Expand All @@ -44,6 +44,12 @@ export function usePaddingAppender() {
.select( blockEditorStore )
.getBlockOrder( '' );
const lastBlockClientId = blockOrder[ blockOrder.length - 1 ];

// Do nothing when only default block appender is present.
if ( ! lastBlockClientId ) {
return;
}

const lastBlock = registry
.select( blockEditorStore )
.getBlock( lastBlockClientId );
Expand Down

1 comment on commit f2503b1

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in f2503b1.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/9015178773
📝 Reported issues:

Please sign in to comment.