Skip to content

Commit

Permalink
Adapt some code after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
DAreRodz committed Feb 13, 2022
1 parent ae28650 commit 91e7a7a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions packages/block-library/src/comment-template/edit.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
import { useState, useMemo, memo } from '@wordpress/element';
import { useState, memo } from '@wordpress/element';
import { useSelect } from '@wordpress/data';
import { __ } from '@wordpress/i18n';
import {
Expand Down Expand Up @@ -220,6 +220,12 @@ export default function CommentTemplateEdit( {
const blockProps = useBlockProps();

const [ activeComment, setActiveComment ] = useState();
const { commentOrder, threadCommentsDepth, threadComments } = useSelect(
( select ) => {
const { getSettings } = select( blockEditorStore );
return getSettings().__experimentalDiscussionSettings;
}
);

const commentQuery = useCommentQueryArgs( {
postId,
Expand All @@ -244,14 +250,10 @@ export default function CommentTemplateEdit( {
[ clientId, commentQuery ]
);

const { commentOrder } = useSelect( ( select ) => {
const { getSettings } = select( blockEditorStore );
return getSettings().__experimentalDiscussionSettings;
} );
order = order || commentOrder;

// Generate a tree structure of comment IDs.
const { commentTree } = useCommentTree(
let commentTree = useCommentTree(
// Reverse the order of top comments if needed.
order === 'desc' && topLevelComments
? [ ...topLevelComments ].reverse()
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/comment-template/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,5 @@ export const useCommentTree = ( topLevelComments ) => {
[ topLevelComments ]
);

return { commentTree };
return commentTree;
};

0 comments on commit 91e7a7a

Please sign in to comment.