From d564bc9bb9450f447444a2678af3c469d8412367 Mon Sep 17 00:00:00 2001 From: Jarda Snajdr Date: Tue, 10 Oct 2023 14:36:23 +0200 Subject: [PATCH] useBlockSync: fix typo and simplify test (#55203) --- .../src/components/provider/test/use-block-sync.js | 2 +- .../block-editor/src/components/provider/use-block-sync.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/block-editor/src/components/provider/test/use-block-sync.js b/packages/block-editor/src/components/provider/test/use-block-sync.js index b1e6a97d137c91..09529c197516a3 100644 --- a/packages/block-editor/src/components/provider/test/use-block-sync.js +++ b/packages/block-editor/src/components/provider/test/use-block-sync.js @@ -31,7 +31,7 @@ const TestWrapper = withRegistryProvider( ( props ) => { props.setRegistry( props.registry ); } useBlockSync( props ); - return

Test.

; + return null; } ); describe( 'useBlockSync hook', () => { diff --git a/packages/block-editor/src/components/provider/use-block-sync.js b/packages/block-editor/src/components/provider/use-block-sync.js index 32dff45d8be679..58aca847d80de0 100644 --- a/packages/block-editor/src/components/provider/use-block-sync.js +++ b/packages/block-editor/src/components/provider/use-block-sync.js @@ -180,7 +180,7 @@ export default function useBlockSync( { // bound sync, unset the outbound value to avoid considering it in // subsequent renders. pendingChanges.current.outgoing = []; - const hadSelecton = hasSelectedBlock(); + const hadSelection = hasSelectedBlock(); const selectionAnchor = getSelectionStart(); const selectionFocus = getSelectionEnd(); setControlledBlocks(); @@ -195,7 +195,7 @@ export default function useBlockSync( { const selectionStillExists = getBlock( selectionAnchor.clientId ); - if ( hadSelecton && ! selectionStillExists ) { + if ( hadSelection && ! selectionStillExists ) { selectBlock( clientId ); } else { resetSelection( selectionAnchor, selectionFocus );