Skip to content

Commit

Permalink
Inline Commenting: Avoid querying comments when the experiment is dis…
Browse files Browse the repository at this point in the history
…abled (#68632)


Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
  • Loading branch information
3 people authored Jan 14, 2025
1 parent 680f51f commit 64e1a8b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 1 addition & 4 deletions packages/editor/src/components/collab-sidebar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ import AddCommentToolbarButton from './comment-button-toolbar';
import { useGlobalStylesContext } from '../global-styles-provider';
import { getCommentIdsFromBlocks } from './utils';

const isBlockCommentExperimentEnabled =
window?.__experimentalEnableBlockComment;
const modifyBlockCommentAttributes = ( settings ) => {
if ( ! settings.attributes.blockCommentId ) {
settings.attributes = {
Expand Down Expand Up @@ -329,8 +327,7 @@ export default function CollabSidebar() {
} );
}

// Check if the experimental flag is enabled.
if ( ! isBlockCommentExperimentEnabled || postStatus === 'publish' ) {
if ( postStatus === 'publish' ) {
return null; // or maybe return some message indicating no threads are available.
}

Expand Down
8 changes: 7 additions & 1 deletion packages/editor/src/components/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ import {
} from '../../store/constants';
import { unlock } from '../../lock-unlock';

const isBlockCommentExperimentEnabled =
window?.__experimentalEnableBlockComment;

const toolbarVariations = {
distractionFreeDisabled: { y: '-50px' },
distractionFreeHover: { y: 0 },
Expand Down Expand Up @@ -195,7 +198,10 @@ function Header( {
}
/>
) }
<CollabSidebar />

{ isBlockCommentExperimentEnabled ? (
<CollabSidebar />
) : undefined }

{ customSaveButton }
<MoreMenu />
Expand Down

0 comments on commit 64e1a8b

Please sign in to comment.