- {tagPages.map((tagPage, pageNum) => (
- // Array index represents the page number
- // eslint-disable-next-line react/no-array-index-key
-
- {tagPage.isLoading ? (
-
-
-
- ) : null }
- {tagPage.isError ? 'Error...' : null /* TODO: show a proper error message */}
+ {tagPages.isLoading ? (
+
+
+
+ ) : null }
+ {tagPages.isError ? 'Error...' : null /* TODO: show a proper error message */}
- {tagPage.data?.map((tagData) => (
-
- (
+
+
+
+
encodeURIComponent(t)).join(',')}
+ isIndeterminate={isImplicit(tagData)}
+ disabled={isImplicit(tagData)}
>
-
-
encodeURIComponent(t)).join(',')}
- isIndeterminate={isImplicit(tagData)}
- disabled={isImplicit(tagData)}
- >
- {tagData.value}
-
- { tagData.childCount > 0
- && (
-
- clickAndEnterHandler(tagData.value)}
- tabIndex="0"
- onKeyPress={(event) => (event.key === 'Enter' ? clickAndEnterHandler(tagData.value) : null)}
- />
-
- )}
-
+
+
+ { tagData.childCount > 0
+ && (
+
+ clickAndEnterHandler(tagData.value)}
+ tabIndex="0"
+ onKeyPress={(event) => (event.key === 'Enter' ? clickAndEnterHandler(tagData.value) : null)}
+ />
+
+ )}
+
-
+
- { tagData.childCount > 0 && isOpen(tagData.value) && (
-
- )}
-
-
- ))}
+ { tagData.childCount > 0 && isOpen(tagData.value) && (
+
+ )}
))}
@@ -141,6 +178,12 @@ const ContentTagsDropDownSelector = ({
)
: null}
+ { tagPages.data.length === 0 && !tagPages.isLoading && (
+
+
+
+ )}
+
);
};
diff --git a/src/content-tags-drawer/ContentTagsDropDownSelector.test.jsx b/src/content-tags-drawer/ContentTagsDropDownSelector.test.jsx
index 8f25e40a2..7800e99e7 100644
--- a/src/content-tags-drawer/ContentTagsDropDownSelector.test.jsx
+++ b/src/content-tags-drawer/ContentTagsDropDownSelector.test.jsx
@@ -13,11 +13,11 @@ import { useTaxonomyTagsData } from './data/apiHooks';
jest.mock('./data/apiHooks', () => ({
useTaxonomyTagsData: jest.fn(() => ({
hasMorePages: false,
- tagPages: [{
+ tagPages: {
isLoading: true,
isError: false,
data: [],
- }],
+ },
})),
}));
@@ -70,7 +70,7 @@ describe('