Skip to content

Commit

Permalink
Post Terms: Fix the 'useSelect' warning in the 'usePostTerms' hook (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka authored Aug 31, 2023
1 parent 0d7548f commit 9ce5048
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/block-library/src/post-terms/use-post-terms.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import { store as coreStore } from '@wordpress/core-data';
import { useSelect } from '@wordpress/data';

const EMPTY_ARRAY = [];

export default function usePostTerms( { postId, term } ) {
const { slug } = term;

Expand All @@ -12,8 +14,8 @@ export default function usePostTerms( { postId, term } ) {
const visible = term?.visibility?.publicly_queryable;
if ( ! visible ) {
return {
postTerms: [],
_isLoading: false,
postTerms: EMPTY_ARRAY,
isLoading: false,
hasPostTerms: false,
};
}
Expand Down

1 comment on commit 9ce5048

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 9ce5048.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6036934810
📝 Reported issues:

Please sign in to comment.