From 68568d98c21d3a19f320b343df330359d6beda46 Mon Sep 17 00:00:00 2001 From: karthick-murugan Date: Thu, 5 Dec 2024 11:26:39 +0530 Subject: [PATCH] Feedback updates --- .../src/components/collab-sidebar/comments.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/editor/src/components/collab-sidebar/comments.js b/packages/editor/src/components/collab-sidebar/comments.js index afd54694f57c74..6b781cc1c79373 100644 --- a/packages/editor/src/components/collab-sidebar/comments.js +++ b/packages/editor/src/components/collab-sidebar/comments.js @@ -17,7 +17,7 @@ import { } from '@wordpress/components'; import { Icon, check, published, moreVertical } from '@wordpress/icons'; import { __, _x } from '@wordpress/i18n'; -import { useSelect, useDispatch } from '@wordpress/data'; +import { useSelect, useDispatch, select } from '@wordpress/data'; import { store as blockEditorStore } from '@wordpress/block-editor'; /** @@ -64,13 +64,13 @@ export function Comments( { setIsConfirmDialogOpen( false ); }; - const { getSelectedBlockClientId, getBlock, getBlocks } = - useSelect( blockEditorStore ); - const blockCommentId = useSelect( () => { - const clientID = getSelectedBlockClientId(); - return getBlock( clientID )?.attributes?.blockCommentId ?? false; - } ); + const clientID = select( blockEditorStore ).getSelectedBlockClientId(); + return ( + select( blockEditorStore ).getBlock( clientID )?.attributes + ?.blockCommentId ?? false + ); + }, [] ); const findBlockByCommentId = ( blocks, commentId ) => { for ( const block of blocks ) { @@ -90,6 +90,7 @@ export function Comments( { return null; }; + const { getBlocks } = useSelect( blockEditorStore ); const { selectBlock } = useDispatch( blockEditorStore ); const handleThreadClick = ( thread ) => { const selClientBlocks = getBlocks();