diff --git a/src/content-tags-drawer/ContentTagsDrawer.jsx b/src/content-tags-drawer/ContentTagsDrawer.jsx index 862c670185..8a5801aa69 100644 --- a/src/content-tags-drawer/ContentTagsDrawer.jsx +++ b/src/content-tags-drawer/ContentTagsDrawer.jsx @@ -49,6 +49,7 @@ const ContentTagsDrawer = ({ id, onClose }) => { toEditMode, toastMessage, closeToast, + setCollapsibleToInitalState, } = context; let onCloseDrawer = onClose; @@ -81,6 +82,11 @@ const ContentTagsDrawer = ({ id, onClose }) => { } }, [commitGlobalStagedTagsStatus]); + // First call of the initial collapsible states + React.useEffect(() => { + setCollapsibleToInitalState(); + }, [isTaxonomyListLoaded, isContentTaxonomyTagsLoaded]); + return (
diff --git a/src/content-tags-drawer/ContentTagsDrawerHelper.jsx b/src/content-tags-drawer/ContentTagsDrawerHelper.jsx index e0897661e0..19806fccab 100644 --- a/src/content-tags-drawer/ContentTagsDrawerHelper.jsx +++ b/src/content-tags-drawer/ContentTagsDrawerHelper.jsx @@ -41,6 +41,7 @@ import messages from './messages'; * toastMessage: string | undefined, * showToastAfterSave: () => void, * closeToast: () => void, + * setCollapsibleToInitalState: () => void, * }} */ const useContentTagsDrawerContext = (contentId) => { @@ -335,11 +336,6 @@ const useContentTagsDrawerContext = (contentId) => { updateTags.mutate({ tagsData }); }, [tagsByTaxonomy]); - // First call of the initial collapsible states - React.useEffect(() => { - setCollapsibleToInitalState(); - }, [isTaxonomyListLoaded, isContentTaxonomyTagsLoaded]); - return { stagedContentTags, addStagedContentTag, @@ -367,6 +363,7 @@ const useContentTagsDrawerContext = (contentId) => { toastMessage, showToastAfterSave, closeToast, + setCollapsibleToInitalState, }; }; diff --git a/src/content-tags-drawer/common/context.js b/src/content-tags-drawer/common/context.js index 8a2b2779a3..bf78d22e76 100644 --- a/src/content-tags-drawer/common/context.js +++ b/src/content-tags-drawer/common/context.js @@ -32,4 +32,5 @@ export const ContentTagsDrawerContext = React.createContext({ toastMessage: /** @type{string|undefined} */ (undefined), showToastAfterSave: /** @type{() => void} */ (() => {}), closeToast: /** @type{() => void} */ (() => {}), + setCollapsibleToInitalState: /** @type{() => void} */ (() => {}), });