From afaf6a280dc98e95d98ccde95cd354810a8a6d32 Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Tue, 3 Jan 2023 16:55:49 +0000 Subject: [PATCH 01/11] =?UTF-8?q?Include=20replace=20in=20tracking=20last?= =?UTF-8?q?=20=E2=80=9Cinserted=E2=80=9D=20block?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/block-editor/src/store/reducer.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/block-editor/src/store/reducer.js b/packages/block-editor/src/store/reducer.js index a19983ce58ff46..60472305d089eb 100644 --- a/packages/block-editor/src/store/reducer.js +++ b/packages/block-editor/src/store/reducer.js @@ -1829,6 +1829,8 @@ export function highlightedBlock( state, action ) { export function lastBlockInserted( state = {}, action ) { switch ( action.type ) { case 'INSERT_BLOCKS': + case 'REPLACE_BLOCKS': + case 'REPLACE_INNER_BLOCKS': if ( ! action.blocks.length ) { return state; } From d1aeb57a2ab090ea38849645f29d3d64054ee9cd Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Wed, 4 Jan 2023 09:26:23 +0000 Subject: [PATCH 02/11] Update reducer tests --- .../block-editor/src/store/test/reducer.js | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/packages/block-editor/src/store/test/reducer.js b/packages/block-editor/src/store/test/reducer.js index 61a51a5f28cd0b..89af21b613027e 100644 --- a/packages/block-editor/src/store/test/reducer.js +++ b/packages/block-editor/src/store/test/reducer.js @@ -3313,6 +3313,48 @@ describe( 'state', () => { expect( state ).toEqual( expectedState ); } ); + it( 'should return client id of first block when blocks are replaced with REPLACE_BLOCKS', () => { + const clientIdOne = '62bfef6e-d5e9-43ba-b7f9-c77cf354141f'; + const clientIdTwo = '9db792c6-a25a-495d-adbd-97d56a4c4189'; + + const action = { + blocks: [ + { + clientId: clientIdOne, + }, + { + clientId: clientIdTwo, + }, + ], + type: 'REPLACE_BLOCKS', + }; + + const state = lastBlockInserted( {}, action ); + + expect( state.clientId ).toBe( clientIdOne ); + } ); + + it( 'should return client id of first block when inner blocks are replaced with REPLACE_INNER_BLOCKS', () => { + const clientIdOne = '62bfef6e-d5e9-43ba-b7f9-c77cf354141f'; + const clientIdTwo = '9db792c6-a25a-495d-adbd-97d56a4c4189'; + + const action = { + blocks: [ + { + clientId: clientIdOne, + }, + { + clientId: clientIdTwo, + }, + ], + type: 'REPLACE_INNER_BLOCKS', + }; + + const state = lastBlockInserted( {}, action ); + + expect( state.clientId ).toBe( clientIdOne ); + } ); + it( 'should return empty state if last block inserted is called with action RESET_BLOCKS', () => { const expectedState = {}; From 7aba184d98e5b7b89f584438218956157a896384 Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Wed, 4 Jan 2023 13:20:02 +0000 Subject: [PATCH 03/11] Make selector experimental --- docs/reference-guides/data/data-core-block-editor.md | 12 ------------ packages/block-editor/src/store/selectors.js | 2 +- packages/block-editor/src/store/test/selectors.js | 2 +- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/docs/reference-guides/data/data-core-block-editor.md b/docs/reference-guides/data/data-core-block-editor.md index 0580aa0141b2be..5123dc6adc1318 100644 --- a/docs/reference-guides/data/data-core-block-editor.md +++ b/docs/reference-guides/data/data-core-block-editor.md @@ -556,18 +556,6 @@ _Properties_ - _isDisabled_ `boolean`: Whether or not the user should be prevented from inserting this item. - _frecency_ `number`: Heuristic that combines frequency and recency. -### getLastInsertedBlockClientId - -Gets the client id of the last inserted block. - -_Parameters_ - -- _state_ `Object`: Global application state. - -_Returns_ - -- `string|undefined`: Client Id of the last inserted block. - ### getLastMultiSelectedBlockClientId Returns the client ID of the last block in the multi-selection set, or null diff --git a/packages/block-editor/src/store/selectors.js b/packages/block-editor/src/store/selectors.js index f096767bf6178c..da8bfe51b21b5d 100644 --- a/packages/block-editor/src/store/selectors.js +++ b/packages/block-editor/src/store/selectors.js @@ -2658,7 +2658,7 @@ export function wasBlockJustInserted( state, clientId, source ) { * @param {Object} state Global application state. * @return {string|undefined} Client Id of the last inserted block. */ -export function getLastInsertedBlockClientId( state ) { +export function __experimentalGetLastInsertedBlockClientId( state ) { return state?.lastBlockInserted?.clientId; } diff --git a/packages/block-editor/src/store/test/selectors.js b/packages/block-editor/src/store/test/selectors.js index ee4e9ee4c167ab..f66cbb54879455 100644 --- a/packages/block-editor/src/store/test/selectors.js +++ b/packages/block-editor/src/store/test/selectors.js @@ -73,7 +73,7 @@ const { __experimentalGetPatternTransformItems, wasBlockJustInserted, __experimentalGetGlobalBlocksByName, - getLastInsertedBlockClientId, + __experimentalGetLastInsertedBlockClientId: getLastInsertedBlockClientId, } = selectors; describe( 'selectors', () => { From 61c71379efa93c2a503f95653cb2ead55fdd1400 Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Wed, 4 Jan 2023 13:44:42 +0000 Subject: [PATCH 04/11] Refactor state to return array of inserted blocks --- packages/block-editor/src/store/reducer.js | 7 +++++-- packages/block-editor/src/store/selectors.js | 7 +++++-- packages/block-editor/src/store/test/reducer.js | 14 +++++++------- packages/block-editor/src/store/test/selectors.js | 8 ++++---- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/packages/block-editor/src/store/reducer.js b/packages/block-editor/src/store/reducer.js index 60472305d089eb..919ca1dceb4e32 100644 --- a/packages/block-editor/src/store/reducer.js +++ b/packages/block-editor/src/store/reducer.js @@ -1835,10 +1835,13 @@ export function lastBlockInserted( state = {}, action ) { return state; } - const clientId = action.blocks[ 0 ].clientId; + const clientIds = action.blocks.map( ( block ) => { + return block.clientId; + } ); + const source = action.meta?.source; - return { clientId, source }; + return { clientIds, source }; case 'RESET_BLOCKS': return {}; } diff --git a/packages/block-editor/src/store/selectors.js b/packages/block-editor/src/store/selectors.js index da8bfe51b21b5d..87aac9aff44b8c 100644 --- a/packages/block-editor/src/store/selectors.js +++ b/packages/block-editor/src/store/selectors.js @@ -2647,7 +2647,7 @@ export const __experimentalGetActiveBlockIdByBlockNames = createSelector( export function wasBlockJustInserted( state, clientId, source ) { const { lastBlockInserted } = state; return ( - lastBlockInserted.clientId === clientId && + lastBlockInserted.clientIds?.includes( clientId ) && lastBlockInserted.source === source ); } @@ -2659,7 +2659,10 @@ export function wasBlockJustInserted( state, clientId, source ) { * @return {string|undefined} Client Id of the last inserted block. */ export function __experimentalGetLastInsertedBlockClientId( state ) { - return state?.lastBlockInserted?.clientId; + return ( + state?.lastBlockInserted?.clientIds?.length && + state?.lastBlockInserted?.clientIds[ 0 ] + ); } /** diff --git a/packages/block-editor/src/store/test/reducer.js b/packages/block-editor/src/store/test/reducer.js index 89af21b613027e..609cbb59c6e54b 100644 --- a/packages/block-editor/src/store/test/reducer.js +++ b/packages/block-editor/src/store/test/reducer.js @@ -3255,7 +3255,7 @@ describe( 'state', () => { } ); describe( 'lastBlockInserted', () => { - it( 'should return client id if last block inserted is called with action INSERT_BLOCKS', () => { + it( 'should contain client id if last block inserted is called with action INSERT_BLOCKS', () => { const expectedClientId = '62bfef6e-d5e9-43ba-b7f9-c77cf354141f'; const action = { @@ -3272,7 +3272,7 @@ describe( 'state', () => { const state = lastBlockInserted( {}, action ); - expect( state.clientId ).toBe( expectedClientId ); + expect( state.clientIds ).toContain( expectedClientId ); } ); it( 'should return inserter_menu source if last block inserted is called with action INSERT_BLOCKS', () => { @@ -3297,7 +3297,7 @@ describe( 'state', () => { it( 'should return state if last block inserted is called with action INSERT_BLOCKS and block list is empty', () => { const expectedState = { - clientId: '9db792c6-a25a-495d-adbd-97d56a4c4189', + clientIds: [ '9db792c6-a25a-495d-adbd-97d56a4c4189' ], }; const action = { @@ -3313,7 +3313,7 @@ describe( 'state', () => { expect( state ).toEqual( expectedState ); } ); - it( 'should return client id of first block when blocks are replaced with REPLACE_BLOCKS', () => { + it( 'should return client ids of blocks when called with REPLACE_BLOCKS', () => { const clientIdOne = '62bfef6e-d5e9-43ba-b7f9-c77cf354141f'; const clientIdTwo = '9db792c6-a25a-495d-adbd-97d56a4c4189'; @@ -3331,10 +3331,10 @@ describe( 'state', () => { const state = lastBlockInserted( {}, action ); - expect( state.clientId ).toBe( clientIdOne ); + expect( state.clientIds ).toEqual( [ clientIdOne, clientIdTwo ] ); } ); - it( 'should return client id of first block when inner blocks are replaced with REPLACE_INNER_BLOCKS', () => { + it( 'should return client ids of all blocks when inner blocks are replaced with REPLACE_INNER_BLOCKS', () => { const clientIdOne = '62bfef6e-d5e9-43ba-b7f9-c77cf354141f'; const clientIdTwo = '9db792c6-a25a-495d-adbd-97d56a4c4189'; @@ -3352,7 +3352,7 @@ describe( 'state', () => { const state = lastBlockInserted( {}, action ); - expect( state.clientId ).toBe( clientIdOne ); + expect( state.clientIds ).toEqual( [ clientIdOne, clientIdTwo ] ); } ); it( 'should return empty state if last block inserted is called with action RESET_BLOCKS', () => { diff --git a/packages/block-editor/src/store/test/selectors.js b/packages/block-editor/src/store/test/selectors.js index f66cbb54879455..a94ac2e11a6daf 100644 --- a/packages/block-editor/src/store/test/selectors.js +++ b/packages/block-editor/src/store/test/selectors.js @@ -4457,7 +4457,7 @@ describe( 'selectors', () => { const state = { lastBlockInserted: { - clientId: expectedClientId, + clientIds: [ expectedClientId ], source, }, }; @@ -4474,7 +4474,7 @@ describe( 'selectors', () => { const state = { lastBlockInserted: { - clientId: unexpectedClientId, + clientIds: [ unexpectedClientId ], source, }, }; @@ -4490,7 +4490,7 @@ describe( 'selectors', () => { const state = { lastBlockInserted: { - clientId, + clientIds: [ clientId ], }, }; @@ -4679,7 +4679,7 @@ describe( 'getLastInsertedBlockClientId', () => { it( 'should return clientId if blocks have been inserted', () => { const state = { lastBlockInserted: { - clientId: '123456', + clientIds: [ '123456' ], }, }; From 78e2d45b5ced66aa8670321d4a3adcd1ea57c30f Mon Sep 17 00:00:00 2001 From: Ben Dwyer Date: Wed, 4 Jan 2023 17:42:10 +0000 Subject: [PATCH 05/11] rename selector --- .../src/components/off-canvas-editor/block-contents.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/block-editor/src/components/off-canvas-editor/block-contents.js b/packages/block-editor/src/components/off-canvas-editor/block-contents.js index d9a24f0d948a2e..f9a24efb233e88 100644 --- a/packages/block-editor/src/components/off-canvas-editor/block-contents.js +++ b/packages/block-editor/src/components/off-canvas-editor/block-contents.js @@ -51,12 +51,13 @@ const ListViewBlockContents = forwardRef( const { hasBlockMovingClientId, getSelectedBlockClientId, - getLastInsertedBlockClientId, + __experimentalGetLastInsertedBlockClientId, } = select( blockEditorStore ); return { blockMovingClientId: hasBlockMovingClientId(), selectedBlockInBlockEditor: getSelectedBlockClientId(), - lastInsertedBlockClientId: getLastInsertedBlockClientId(), + lastInsertedBlockClientId: + __experimentalGetLastInsertedBlockClientId(), }; }, [ clientId ] From 8ad7090f5ca8a30530c5d510cc1457b546de7e80 Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Thu, 5 Jan 2023 09:14:33 +0000 Subject: [PATCH 06/11] Deprecates existing function --- .../data/data-core-block-editor.md | 14 ++++++++++++++ packages/block-editor/src/store/selectors.js | 13 ++++++++++++- packages/block-editor/src/store/test/selectors.js | 2 +- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/docs/reference-guides/data/data-core-block-editor.md b/docs/reference-guides/data/data-core-block-editor.md index 5123dc6adc1318..f29f21880148b1 100644 --- a/docs/reference-guides/data/data-core-block-editor.md +++ b/docs/reference-guides/data/data-core-block-editor.md @@ -556,6 +556,20 @@ _Properties_ - _isDisabled_ `boolean`: Whether or not the user should be prevented from inserting this item. - _frecency_ `number`: Heuristic that combines frequency and recency. +### getLastInsertedBlockClientId + +> **Deprecated** + +Gets the client id of the last inserted block. + +_Parameters_ + +- _state_ `Object`: Global application state. + +_Returns_ + +- `string|undefined`: Client Id of the last inserted block. + ### getLastMultiSelectedBlockClientId Returns the client ID of the last block in the multi-selection set, or null diff --git a/packages/block-editor/src/store/selectors.js b/packages/block-editor/src/store/selectors.js index 87aac9aff44b8c..ab6f7a0512efab 100644 --- a/packages/block-editor/src/store/selectors.js +++ b/packages/block-editor/src/store/selectors.js @@ -2655,10 +2655,21 @@ export function wasBlockJustInserted( state, clientId, source ) { /** * Gets the client id of the last inserted block. * + * @deprecated * @param {Object} state Global application state. * @return {string|undefined} Client Id of the last inserted block. */ -export function __experimentalGetLastInsertedBlockClientId( state ) { +export function getLastInsertedBlockClientId( state ) { + deprecated( + 'wp.data.select( "core/block-editor" ).getLastInsertedBlockClientId', + { + since: '15.0', + plugin: 'Gutenberg', + alternative: + 'wp.data.select( "core/block-editor" ).getLastInsertedBlocksClientIds', + } + ); + return ( state?.lastBlockInserted?.clientIds?.length && state?.lastBlockInserted?.clientIds[ 0 ] diff --git a/packages/block-editor/src/store/test/selectors.js b/packages/block-editor/src/store/test/selectors.js index a94ac2e11a6daf..f4442092f2f7be 100644 --- a/packages/block-editor/src/store/test/selectors.js +++ b/packages/block-editor/src/store/test/selectors.js @@ -73,7 +73,7 @@ const { __experimentalGetPatternTransformItems, wasBlockJustInserted, __experimentalGetGlobalBlocksByName, - __experimentalGetLastInsertedBlockClientId: getLastInsertedBlockClientId, + getLastInsertedBlockClientId, } = selectors; describe( 'selectors', () => { From a528159350a5196b385405b48c376afa9d247b8b Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Thu, 5 Jan 2023 09:16:02 +0000 Subject: [PATCH 07/11] Adds selector to return multiple blocks --- docs/reference-guides/data/data-core-block-editor.md | 12 ++++++++++++ packages/block-editor/src/store/selectors.js | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/docs/reference-guides/data/data-core-block-editor.md b/docs/reference-guides/data/data-core-block-editor.md index f29f21880148b1..a7232ac270ca5d 100644 --- a/docs/reference-guides/data/data-core-block-editor.md +++ b/docs/reference-guides/data/data-core-block-editor.md @@ -570,6 +570,18 @@ _Returns_ - `string|undefined`: Client Id of the last inserted block. +### getLastInsertedBlocksClientIds + +Gets the client ids of the last inserted blocks. + +_Parameters_ + +- _state_ `Object`: Global application state. + +_Returns_ + +- `Array|undefined`: Client Ids of the last inserted block(s). + ### getLastMultiSelectedBlockClientId Returns the client ID of the last block in the multi-selection set, or null diff --git a/packages/block-editor/src/store/selectors.js b/packages/block-editor/src/store/selectors.js index ab6f7a0512efab..80053e63ef03f4 100644 --- a/packages/block-editor/src/store/selectors.js +++ b/packages/block-editor/src/store/selectors.js @@ -2676,6 +2676,16 @@ export function getLastInsertedBlockClientId( state ) { ); } +/** + * Gets the client ids of the last inserted blocks. + * + * @param {Object} state Global application state. + * @return {Array|undefined} Client Ids of the last inserted block(s). + */ +export function getLastInsertedBlocksClientIds( state ) { + return state?.lastBlockInserted?.clientIds; +} + /** * Tells if the block is visible on the canvas or not. * From b5de919e4f8caae949984d86a7a61317c8987848 Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Thu, 5 Jan 2023 09:25:46 +0000 Subject: [PATCH 08/11] Add tests for new selector --- packages/block-editor/src/store/test/selectors.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/block-editor/src/store/test/selectors.js b/packages/block-editor/src/store/test/selectors.js index f4442092f2f7be..2984171787c329 100644 --- a/packages/block-editor/src/store/test/selectors.js +++ b/packages/block-editor/src/store/test/selectors.js @@ -73,7 +73,7 @@ const { __experimentalGetPatternTransformItems, wasBlockJustInserted, __experimentalGetGlobalBlocksByName, - getLastInsertedBlockClientId, + getLastInsertedBlocksClientIds, } = selectors; describe( 'selectors', () => { @@ -4667,22 +4667,25 @@ describe( '__unstableGetClientIdsTree', () => { } ); } ); -describe( 'getLastInsertedBlockClientId', () => { +describe( 'getLastInsertedBlocksClientIds', () => { it( 'should return undefined if no blocks have been inserted', () => { const state = { lastBlockInserted: {}, }; - expect( getLastInsertedBlockClientId( state ) ).toEqual( undefined ); + expect( getLastInsertedBlocksClientIds( state ) ).toEqual( undefined ); } ); - it( 'should return clientId if blocks have been inserted', () => { + it( 'should return clientIds if blocks have been inserted', () => { const state = { lastBlockInserted: { - clientIds: [ '123456' ], + clientIds: [ '123456', '78910' ], }, }; - expect( getLastInsertedBlockClientId( state ) ).toEqual( '123456' ); + expect( getLastInsertedBlocksClientIds( state ) ).toEqual( [ + '123456', + '78910', + ] ); } ); } ); From c74eaf1e1928abd6c86cec105fc5ea4ead1ac2bd Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Thu, 5 Jan 2023 09:36:20 +0000 Subject: [PATCH 09/11] Fix usage to utilise new selector --- .../src/components/off-canvas-editor/block-contents.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/block-editor/src/components/off-canvas-editor/block-contents.js b/packages/block-editor/src/components/off-canvas-editor/block-contents.js index f9a24efb233e88..26a5abfc9bd0cd 100644 --- a/packages/block-editor/src/components/off-canvas-editor/block-contents.js +++ b/packages/block-editor/src/components/off-canvas-editor/block-contents.js @@ -51,13 +51,13 @@ const ListViewBlockContents = forwardRef( const { hasBlockMovingClientId, getSelectedBlockClientId, - __experimentalGetLastInsertedBlockClientId, + getLastInsertedBlockClientIds, } = select( blockEditorStore ); return { blockMovingClientId: hasBlockMovingClientId(), selectedBlockInBlockEditor: getSelectedBlockClientId(), lastInsertedBlockClientId: - __experimentalGetLastInsertedBlockClientId(), + getLastInsertedBlockClientIds()[ 0 ], }; }, [ clientId ] From e14860f2ad0f5e42c10dd69dee6dae806545794d Mon Sep 17 00:00:00 2001 From: Ben Dwyer Date: Thu, 5 Jan 2023 10:10:30 +0000 Subject: [PATCH 10/11] fix selector name --- .../src/components/off-canvas-editor/block-contents.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/block-editor/src/components/off-canvas-editor/block-contents.js b/packages/block-editor/src/components/off-canvas-editor/block-contents.js index 26a5abfc9bd0cd..c2cbd970b09b9b 100644 --- a/packages/block-editor/src/components/off-canvas-editor/block-contents.js +++ b/packages/block-editor/src/components/off-canvas-editor/block-contents.js @@ -51,13 +51,13 @@ const ListViewBlockContents = forwardRef( const { hasBlockMovingClientId, getSelectedBlockClientId, - getLastInsertedBlockClientIds, + getLastInsertedBlocksClientIds, } = select( blockEditorStore ); return { blockMovingClientId: hasBlockMovingClientId(), selectedBlockInBlockEditor: getSelectedBlockClientId(), lastInsertedBlockClientId: - getLastInsertedBlockClientIds()[ 0 ], + getLastInsertedBlocksClientIds()[ 0 ], }; }, [ clientId ] From 7fe30705446f6b4f6ee5a55ad57d9d8128147283 Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Thu, 5 Jan 2023 11:41:16 +0000 Subject: [PATCH 11/11] Remove selector As per @youknowriad advice in https://github.com/WordPress/gutenberg/pull/46885#discussion_r1062346033 --- .../data/data-core-block-editor.md | 14 ----------- packages/block-editor/src/store/selectors.js | 24 ------------------- 2 files changed, 38 deletions(-) diff --git a/docs/reference-guides/data/data-core-block-editor.md b/docs/reference-guides/data/data-core-block-editor.md index a7232ac270ca5d..1b9da160f0f6fb 100644 --- a/docs/reference-guides/data/data-core-block-editor.md +++ b/docs/reference-guides/data/data-core-block-editor.md @@ -556,20 +556,6 @@ _Properties_ - _isDisabled_ `boolean`: Whether or not the user should be prevented from inserting this item. - _frecency_ `number`: Heuristic that combines frequency and recency. -### getLastInsertedBlockClientId - -> **Deprecated** - -Gets the client id of the last inserted block. - -_Parameters_ - -- _state_ `Object`: Global application state. - -_Returns_ - -- `string|undefined`: Client Id of the last inserted block. - ### getLastInsertedBlocksClientIds Gets the client ids of the last inserted blocks. diff --git a/packages/block-editor/src/store/selectors.js b/packages/block-editor/src/store/selectors.js index 80053e63ef03f4..a29220305e6c65 100644 --- a/packages/block-editor/src/store/selectors.js +++ b/packages/block-editor/src/store/selectors.js @@ -2652,30 +2652,6 @@ export function wasBlockJustInserted( state, clientId, source ) { ); } -/** - * Gets the client id of the last inserted block. - * - * @deprecated - * @param {Object} state Global application state. - * @return {string|undefined} Client Id of the last inserted block. - */ -export function getLastInsertedBlockClientId( state ) { - deprecated( - 'wp.data.select( "core/block-editor" ).getLastInsertedBlockClientId', - { - since: '15.0', - plugin: 'Gutenberg', - alternative: - 'wp.data.select( "core/block-editor" ).getLastInsertedBlocksClientIds', - } - ); - - return ( - state?.lastBlockInserted?.clientIds?.length && - state?.lastBlockInserted?.clientIds[ 0 ] - ); -} - /** * Gets the client ids of the last inserted blocks. *