Web:Client:Home: fix clearAll

This commit is contained in:
TimofeyBoyko 2022-09-15 18:18:36 +03:00
parent 25188c57b8
commit ca485bc41d
2 changed files with 17 additions and 1 deletions

View File

@ -11,6 +11,8 @@ import {
FilterKeys,
} from "@docspace/client/src/helpers/filesConstants";
import FilesFilter from "@docspace/common/api/people/filter";
import RoomsFilter from "@docspace/common/api/rooms/filter";
import { getUser } from "@docspace/common/api/people";
import { FilterType, RoomsType } from "@docspace/common/constants";
import Loaders from "@docspace/common/components/Loaders";
@ -1003,6 +1005,18 @@ const SectionFilterContent = ({
]
);
const clearAll = () => {
if (isRooms) {
setIsLoading(true);
fetchRooms(selectedFolderId).finally(() => setIsLoading(false));
} else {
setIsLoading(true);
fetchFiles(selectedFolderId).finally(() => setIsLoading(false));
}
};
return (
<FilterInput
t={t}
@ -1026,6 +1040,7 @@ const SectionFilterContent = ({
isPersonalRoom={isPersonalRoom}
isRooms={isRooms}
removeSelectedItem={removeSelectedItem}
clearAll={clearAll}
/>
);
};

View File

@ -35,6 +35,7 @@ const FilterInput = React.memo(
filterHeader,
selectorLabel,
clearAll,
isRecentFolder,
removeSelectedItem,
@ -174,7 +175,7 @@ const FilterInput = React.memo(
fontWeight={600}
isSemitransparent
type="action"
onClick={() => onFilter([])}
onClick={clearAll}
>
{t("Common:ClearAll")}
</Link>