Skip to content

Commit

Permalink
Feedback updates
Browse files Browse the repository at this point in the history
  • Loading branch information
karthick-murugan committed Dec 5, 2024
1 parent e5d379b commit 939f2f5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/editor/src/components/collab-sidebar/comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from '@wordpress/components';
import { Icon, check, published, moreVertical } from '@wordpress/icons';
import { __, _x } from '@wordpress/i18n';
import { useSelect, useDispatch, select } from '@wordpress/data';
import { useSelect, useDispatch } from '@wordpress/data';
import { store as blockEditorStore } from '@wordpress/block-editor';

/**
Expand Down Expand Up @@ -64,13 +64,13 @@ export function Comments( {
setIsConfirmDialogOpen( false );
};

const { getSelectedBlockClientId, getBlock, getBlocks } =
useSelect( blockEditorStore );

const blockCommentId = useSelect( () => {
const clientID = select( blockEditorStore ).getSelectedBlockClientId();
return (
select( blockEditorStore ).getBlock( clientID )?.attributes
?.blockCommentId ?? false
);
}, [] );
const clientID = getSelectedBlockClientId();
return getBlock( clientID )?.attributes?.blockCommentId ?? false;
} );

const findBlockByCommentId = ( blocks, commentId ) => {
for ( const block of blocks ) {
Expand All @@ -92,7 +92,7 @@ export function Comments( {

const { selectBlock } = useDispatch( blockEditorStore );
const handleThreadClick = ( thread ) => {
const selClientBlocks = select( blockEditorStore ).getBlocks();
const selClientBlocks = getBlocks();
const block = findBlockByCommentId( selClientBlocks, thread.id );
if ( block ) {
selectBlock( block.clientId ); // Use the action to select the block
Expand Down

0 comments on commit 939f2f5

Please sign in to comment.