Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/js/components/bulkDownload/DEFCheckboxTreeDownload.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ const DEFCheckboxTreeDownload = ({
detailsDisplay(validDefCodes);
}, [validDefCodes]);

useEffect(() => {
if (isDisabled && defCodes.length){
dispatch(setDefCodes(type, []));
}
}, [defCodes, dispatch, isDisabled, type])

return (
<div className="def-code-filter-download">
{isLoading && loadingIndicator }
Expand Down
12 changes: 10 additions & 2 deletions src/js/components/sharedComponents/checkbox/AccordionCheckbox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,20 @@ const AccordionCheckbox = ({
};

useEffect(() => {
if (isExpanded) {
if (isDisabled && expandedCategories?.length) {
// have to check expandeCategories instead of isExpanded.
// isExpanded might not be known by parent
// collapse expandedCategories
expandedCategories.forEach((ec) => toggleExpanded({id: ec}));

}
else if (isExpanded) {
const category = filterCategoryMapping.find((item) => item.id === selectedCategory);
toggleExpanded(category);
}

// eslint-disable-next-line react-hooks/exhaustive-deps
}, [filterCategoryMapping, isExpanded, selectedCategory]);
}, [filterCategoryMapping, isExpanded, selectedCategory, isDisabled]);

const handleTextInputChange = (e) => {
setSearchString(e.target.value);
Expand Down
Loading