diff --git a/packages/client/src/components/EmptyContainer/EmptyFilterContainer.js b/packages/client/src/components/EmptyContainer/EmptyFilterContainer.js
index 01fa9168ed..2833828493 100644
--- a/packages/client/src/components/EmptyContainer/EmptyFilterContainer.js
+++ b/packages/client/src/components/EmptyContainer/EmptyFilterContainer.js
@@ -2,6 +2,7 @@
import EmptyScreenFilterAltDarkSvgUrl from "PUBLIC_DIR/images/empty_screen_filter_alt_dark.svg?url";
import ClearEmptyFilterSvgUrl from "PUBLIC_DIR/images/clear.empty.filter.svg?url";
import React from "react";
+import { useNavigate, useLocation } from "react-router-dom";
import { withTranslation } from "react-i18next";
import { inject, observer } from "mobx-react";
import EmptyContainer from "./EmptyContainer";
@@ -15,8 +16,7 @@ const EmptyFilterContainer = ({
t,
selectedFolderId,
setIsLoading,
- fetchFiles,
- fetchRooms,
+
linkStyles,
isRooms,
isArchiveFolder,
@@ -24,6 +24,9 @@ const EmptyFilterContainer = ({
setClearSearch,
theme,
}) => {
+ const navigate = useNavigate();
+ const location = useLocation();
+
const subheadingText = t("EmptyFilterSubheadingText");
const descriptionText = isRooms
? t("Common:SearchEmptyRoomsDescription")
@@ -39,14 +42,16 @@ const EmptyFilterContainer = ({
if (isRoomsFolder) {
const newFilter = RoomsFilter.getDefault();
- fetchRooms(selectedFolderId, newFilter)
- .catch((err) => toastr.error(err))
- .finally(() => setIsLoading(false));
+
+ navigate(`/rooms/shared/filter?${newFilter.toUrlParams()}`);
} else {
const newFilter = FilesFilter.getDefault();
- fetchFiles(selectedFolderId, newFilter)
- .catch((err) => toastr.error(err))
- .finally(() => setIsLoading(false));
+
+ newFilter.folder = selectedFolderId;
+
+ const path = location.pathname.split("/filter")[0];
+
+ navigate(`${path}/filter?${newFilter.toUrlParams()}`);
}
};
@@ -86,8 +91,6 @@ export default inject(
const isRooms = isRoomsFolder || isArchiveFolder;
return {
- fetchFiles: filesStore.fetchFiles,
- fetchRooms: filesStore.fetchRooms,
selectedFolderId: selectedFolderStore.id,
setIsLoading: filesStore.setIsLoading,
isRooms,
diff --git a/packages/client/src/components/EmptyContainer/EmptyFolderContainer.js b/packages/client/src/components/EmptyContainer/EmptyFolderContainer.js
index 278e1e4e3f..9f1e68ca41 100644
--- a/packages/client/src/components/EmptyContainer/EmptyFolderContainer.js
+++ b/packages/client/src/components/EmptyContainer/EmptyFolderContainer.js
@@ -6,20 +6,23 @@ import EmptyScreenCorporateSvgUrl from "PUBLIC_DIR/images/empty_screen_corporate
import EmptyScreenCorporateDarkSvgUrl from "PUBLIC_DIR/images/empty_screen_corporate_dark.svg?url";
import { inject, observer } from "mobx-react";
import React, { useEffect } from "react";
+import { useNavigate, useLocation } from "react-router-dom";
import { withTranslation } from "react-i18next";
import EmptyContainer from "./EmptyContainer";
import Link from "@docspace/components/link";
import Box from "@docspace/components/box";
import { Text } from "@docspace/components";
import { ReactSVG } from "react-svg";
+import FilesFilter from "@docspace/common/api/files/filter";
+import RoomsFilter from "@docspace/common/api/rooms/filter";
import Loaders from "@docspace/common/components/Loaders";
import { showLoader, hideLoader } from "./EmptyFolderContainerUtils";
+import { FolderType, RoomSearchArea } from "@docspace/common/constants";
const EmptyFolderContainer = ({
t,
onCreate,
- fetchFiles,
- fetchRooms,
+
setIsLoading,
parentId,
linkStyles,
@@ -30,33 +33,70 @@ const EmptyFolderContainer = ({
onClickInviteUsers,
folderId,
- tReady,
- isLoadedFetchFiles,
- viewAs,
- setIsLoadedEmptyPage,
+
theme,
+
+ navigationPath,
+ rootFolderType,
+ clearFiles,
}) => {
+ const navigate = useNavigate();
+ const location = useLocation();
+
const onBackToParentFolder = () => {
setIsLoading(true);
- isRooms
- ? fetchRooms(parentId).finally(() => setIsLoading(false))
- : fetchFiles(parentId).finally(() => setIsLoading(false));
- };
+ if (isRooms) {
+ const path =
+ rootFolderType === FolderType.Archive
+ ? "rooms/archived"
+ : "rooms/shared";
- useEffect(() => {
- if (isLoadedFetchFiles && tReady) {
- setIsLoadedEmptyPage(true);
+ const newFilter = RoomsFilter.getDefault();
+
+ newFilter.searchArea =
+ rootFolderType === FolderType.Archive
+ ? RoomSearchArea.Archive
+ : RoomSearchArea.Active;
+
+ const state = {
+ title: navigationPath[0].title,
+ isRoot: true,
+ isEmpty: false,
+ rootFolderType,
+ };
+
+ clearFiles(false);
+
+ navigate(`${path}/filter?${newFilter.toUrlParams()}`, {
+ state,
+ });
} else {
- setIsLoadedEmptyPage(false);
- }
- }, [isLoadedFetchFiles, tReady]);
+ let path = location.pathname.split("/filter")[0];
+ const splittedPath = path.split("/");
+ if (splittedPath.length > 3) {
+ splittedPath[3] = `${parentId}`;
+ }
+ const newFilter = FilesFilter.getDefault();
+ newFilter.folder = `${parentId}`;
- useEffect(() => {
- return () => {
- setIsLoadedEmptyPage(false);
- };
- }, []);
+ const parentIdx = navigationPath.findIndex((v) => v.id === parentId);
+
+ const parentItem = navigationPath[parentIdx];
+
+ const state = {
+ title: parentItem.title,
+ isRoot: navigationPath.length === 1,
+ isEmpty: false,
+ rootFolderType,
+ };
+
+ clearFiles(false);
+ navigate(`${splittedPath.join("/")}/filter?${newFilter.toUrlParams()}`, {
+ state,
+ });
+ }
+ };
const onInviteUsersClick = () => {
if (!isRooms) return;
@@ -147,21 +187,6 @@ const EmptyFolderContainer = ({
? EmptyScreenAltSvgUrl
: EmptyScreenAltSvgDarkUrl;
- useEffect(
- () => (!isLoadedFetchFiles || !tReady ? showLoader() : hideLoader()),
- [isLoadedFetchFiles, tReady]
- );
-
- if (!isLoadedFetchFiles || !tReady) {
- return (
-
- );
- }
-
return (
{
- const {
- fetchFiles,
- fetchRooms,
-
- isLoadedFetchFiles,
- viewAs,
- setIsLoadedEmptyPage,
- } = filesStore;
+ const { clearFiles } = filesStore;
const {
navigationPath,
parentId,
- access,
+
id: folderId,
roomType,
security,
+ rootFolderType,
} = selectedFolderStore;
let id;
@@ -219,19 +238,19 @@ export default inject(
const canInviteUsers = isRooms && security?.EditAccess; // skip sub-folders
return {
- fetchFiles,
- fetchRooms,
setIsLoading: filesStore.setIsLoading,
parentId: id ?? parentId,
isRooms,
canCreateFiles,
canInviteUsers,
+ navigationPath,
+ rootFolderType,
+ clearFiles,
+
onClickInviteUsers,
folderId,
- isLoadedFetchFiles,
- viewAs,
- setIsLoadedEmptyPage,
+
theme: auth.settingsStore.theme,
};
}
diff --git a/packages/client/src/components/EmptyContainer/RoomNoAccessContainer.js b/packages/client/src/components/EmptyContainer/RoomNoAccessContainer.js
index c681ecf630..425d518393 100644
--- a/packages/client/src/components/EmptyContainer/RoomNoAccessContainer.js
+++ b/packages/client/src/components/EmptyContainer/RoomNoAccessContainer.js
@@ -18,9 +18,7 @@ const RoomNoAccessContainer = (props) => {
t,
setIsLoading,
linkStyles,
- fetchRooms,
- setAlreadyFetchingRooms,
- categoryType,
+
isEmptyPage,
sectionWidth,
theme,
@@ -39,22 +37,11 @@ const RoomNoAccessContainer = (props) => {
const onGoToShared = () => {
setIsLoading(true);
- setAlreadyFetchingRooms(true);
- fetchRooms(null, null)
- .then(() => {
- const filter = RoomsFilter.getDefault();
+ const filter = RoomsFilter.getDefault();
- const filterParamsStr = filter.toUrlParams();
+ const filterParamsStr = filter.toUrlParams();
- const url = getCategoryUrl(categoryType, filter.folder);
-
- const pathname = `${url}?${filterParamsStr}`;
-
- navigate(pathname);
- })
- .finally(() => {
- setIsLoading(false);
- });
+ navigate(`rooms/shared/filter?${filterParamsStr}`);
};
const goToButtons = (
@@ -94,16 +81,12 @@ const RoomNoAccessContainer = (props) => {
export default inject(({ auth, filesStore }) => {
const {
setIsLoading,
- fetchRooms,
- categoryType,
- setAlreadyFetchingRooms,
+
isEmptyPage,
} = filesStore;
return {
setIsLoading,
- fetchRooms,
- categoryType,
- setAlreadyFetchingRooms,
+
isEmptyPage,
theme: auth.settingsStore.theme,
};
diff --git a/packages/client/src/components/EmptyContainer/RootFolderContainer.js b/packages/client/src/components/EmptyContainer/RootFolderContainer.js
index b0f79bc714..6d394f5767 100644
--- a/packages/client/src/components/EmptyContainer/RootFolderContainer.js
+++ b/packages/client/src/components/EmptyContainer/RootFolderContainer.js
@@ -5,7 +5,7 @@ import EmptyFolderImageSvgUrl from "PUBLIC_DIR/images/empty-folder-image.svg?url
import React, { useEffect } from "react";
import { useNavigate, useLocation } from "react-router-dom";
import styled from "styled-components";
-import { FolderType } from "@docspace/common/constants";
+import { FolderType, RoomSearchArea } from "@docspace/common/constants";
import { inject, observer } from "mobx-react";
import { withTranslation, Trans } from "react-i18next";
import EmptyContainer from "./EmptyContainer";
@@ -14,6 +14,7 @@ import Text from "@docspace/components/text";
import Box from "@docspace/components/box";
import RoomsFilter from "@docspace/common/api/rooms/filter";
+import FilesFilter from "@docspace/common/api/files/filter";
import { getCategoryUrl } from "SRC_DIR/helpers/utils";
import PlusIcon from "PUBLIC_DIR/images/plus.react.svg";
@@ -70,6 +71,10 @@ const RootFolderContainer = (props) => {
sectionWidth,
setIsLoadedEmptyPage,
security,
+
+ myFolder,
+ roomsFolder,
+ clearFiles,
} = props;
const personalDescription = t("EmptyFolderDecription");
@@ -103,41 +108,44 @@ const RootFolderContainer = (props) => {
const roomHeader = "Welcome to DocSpace";
- useEffect(() => {
- return () => {
- setIsLoadedEmptyPage(false);
- };
- }, []);
-
- useEffect(() => {
- setIsLoadedEmptyPage(!isLoading);
- }, [isLoading]);
-
const onGoToPersonal = () => {
- const newFilter = filter.clone();
+ const newFilter = FilesFilter.getDefault();
+
+ newFilter.folder = myFolderId;
+
+ const isEmpty = myFolder.filesCount + myFolder.foldersCount === 0;
+
+ const state = {
+ title: myFolder.title,
+ isEmpty,
+ isRoot: true,
+ rootFolderType: myFolder.rootFolderType,
+ };
+
+ clearFiles(isEmpty);
setIsLoading(true);
- fetchFiles(myFolderId, newFilter).finally(() => setIsLoading(false));
+
+ navigate(`/rooms/personal/filter?${newFilter.toUrlParams()}`, { state });
};
const onGoToShared = () => {
+ const newFilter = RoomsFilter.getDefault();
+
+ newFilter.searchArea = RoomSearchArea.Active;
+
+ const isEmpty = roomsFolder.foldersCount === 0;
+
+ const state = {
+ title: roomsFolder.title,
+ isEmpty,
+ isRoot: true,
+ rootFolderType: roomsFolder.rootFolderType,
+ };
+
+ clearFiles(isEmpty);
setIsLoading(true);
- setAlreadyFetchingRooms(true);
- fetchRooms(null, null)
- .then(() => {
- const filter = RoomsFilter.getDefault();
-
- const filterParamsStr = filter.toUrlParams();
-
- const url = getCategoryUrl(categoryType, filter.folder);
-
- const pathname = `${url}?${filterParamsStr}`;
-
- navigate(pathname);
- })
- .finally(() => {
- setIsLoading(false);
- });
+ navigate(`/rooms/shared/filter?${newFilter.toUrlParams()}`, { state });
};
const getEmptyFolderProps = () => {
@@ -383,11 +391,13 @@ export default inject(
categoryType,
setAlreadyFetchingRooms,
isEmptyPage,
+ clearFiles,
setIsLoadedEmptyPage,
} = filesStore;
const { title, rootFolderType, security } = selectedFolderStore;
- const { isPrivacyFolder, myFolderId } = treeFoldersStore;
+ const { isPrivacyFolder, myFolderId, myFolder, roomsFolder } =
+ treeFoldersStore;
return {
theme,
@@ -413,6 +423,10 @@ export default inject(
setIsLoadedEmptyPage,
security,
+
+ myFolder,
+ roomsFolder,
+ clearFiles,
};
}
)(withTranslation(["Files"])(observer(RootFolderContainer)));
diff --git a/packages/client/src/components/EmptyContainer/index.js b/packages/client/src/components/EmptyContainer/index.js
index 2a3f690efc..f29a6a98ee 100644
--- a/packages/client/src/components/EmptyContainer/index.js
+++ b/packages/client/src/components/EmptyContainer/index.js
@@ -22,7 +22,7 @@ const EmptyContainer = ({
isFiltered,
parentId,
theme,
- setCreateRoomDialogVisible,
+
sectionWidth,
isRoomNotFoundOrMoved,
isGracePeriod,
@@ -100,8 +100,7 @@ export default inject(
const { isGracePeriod } = auth.currentTariffStatusStore;
- const { setCreateRoomDialogVisible, setInviteUsersWarningDialogVisible } =
- dialogsStore;
+ const { setInviteUsersWarningDialogVisible } = dialogsStore;
const isRoomNotFoundOrMoved =
isFiltered === null &&
@@ -111,7 +110,6 @@ export default inject(
return {
theme: auth.settingsStore.theme,
isFiltered,
- setCreateRoomDialogVisible,
parentId: selectedFolderStore.parentId,
isRoomNotFoundOrMoved,
diff --git a/packages/client/src/pages/Home/Hooks/useAccounts.js b/packages/client/src/pages/Home/Hooks/useAccounts.js
index 24d78c7224..f781771596 100644
--- a/packages/client/src/pages/Home/Hooks/useAccounts.js
+++ b/packages/client/src/pages/Home/Hooks/useAccounts.js
@@ -8,7 +8,9 @@ const useAccounts = ({
t,
isAccountsPage,
location,
+
setIsLoading,
+ setFirstLoad,
setSelectedNode,
fetchPeople,
@@ -29,6 +31,7 @@ const useAccounts = ({
})
.finally(() => {
setIsLoading(false);
+ setFirstLoad(false);
});
}, [isAccountsPage, location.pathname, location.search]);
};
diff --git a/packages/client/src/pages/Home/Hooks/useSettings.js b/packages/client/src/pages/Home/Hooks/useSettings.js
index f634ba766d..bf9c3f9221 100644
--- a/packages/client/src/pages/Home/Hooks/useSettings.js
+++ b/packages/client/src/pages/Home/Hooks/useSettings.js
@@ -2,12 +2,15 @@ import React from "react";
import { setDocumentTitle } from "SRC_DIR/helpers/utils";
-const useSettings = ({ t, isSettingsPage, location }) => {
+const useSettings = ({ t, isSettingsPage, setFirstLoad, setIsLoading }) => {
React.useEffect(() => {
if (!isSettingsPage) return;
setDocumentTitle(t("Common:Settings"));
- }, [isSettingsPage, location]);
+
+ setIsLoading(false);
+ setFirstLoad(false);
+ }, [isSettingsPage]);
};
export default useSettings;
diff --git a/packages/client/src/pages/Home/Section/Filter/index.js b/packages/client/src/pages/Home/Section/Filter/index.js
index c61229a4e7..662afc710b 100644
--- a/packages/client/src/pages/Home/Section/Filter/index.js
+++ b/packages/client/src/pages/Home/Section/Filter/index.js
@@ -1,6 +1,6 @@
import React, { useCallback, useEffect } from "react";
import { inject, observer } from "mobx-react";
-import { useLocation } from "react-router-dom";
+import { useLocation, useNavigate } from "react-router-dom";
import { isMobile, isMobileOnly } from "react-device-detect";
import { withTranslation } from "react-i18next";
import find from "lodash/find";
@@ -11,6 +11,8 @@ import Loaders from "@docspace/common/components/Loaders";
import { withLayoutSize } from "@docspace/common/utils";
import { getUser } from "@docspace/common/api/people";
import RoomsFilter from "@docspace/common/api/rooms/filter";
+import AccountsFilter from "@docspace/common/api/people/filter";
+import FilesFilter from "@docspace/common/api/files/filter";
import {
FilterGroups,
FilterKeys,
@@ -199,29 +201,27 @@ const SectionFilterContent = ({
createThumbnails,
setViewAs,
setIsLoading,
- selectedFolderId,
- fetchFiles,
- fetchRooms,
+
fetchTags,
infoPanelVisible,
isRooms,
isTrash,
userId,
isPersonalRoom,
- setCurrentRoomsFilter,
+
providers,
- isLoadedEmptyPage,
- isEmptyPage,
+
clearSearch,
setClearSearch,
setMainButtonMobileVisible,
isArchiveFolder,
accountsViewAs,
groups,
- fetchPeople,
+
accountsFilter,
}) => {
const location = useLocation();
+ const navigate = useNavigate();
const isAccountsPage = location.pathname.includes("accounts");
@@ -229,8 +229,8 @@ const SectionFilterContent = ({
const onFilter = React.useCallback(
(data) => {
+ setIsLoading(true);
if (isAccountsPage) {
- setIsLoading(true);
const status = getStatus(data);
const role = getRole(data);
@@ -257,9 +257,8 @@ const SectionFilterContent = ({
newFilter.group = group;
newFilter.payments = payments;
- //console.log(newFilter);
- fetchPeople(newFilter, true).finally(() => setIsLoading(false));
+ navigate(`accounts/filter?${newFilter.toUrlParams()}`);
} else if (isRooms) {
const type = getType(data) || null;
@@ -270,13 +269,6 @@ const SectionFilterContent = ({
const providerType = getProviderType(data) || null;
const tags = getTags(data) || null;
- // const withSubfolders =
- // getFilterFolders(data) === FilterKeys.withSubfolders;
-
- // const withContent = getFilterContent(data) === FilterKeys.withContent;
-
- setIsLoading(true);
-
const newFilter = roomsFilter.clone();
newFilter.page = 0;
@@ -311,12 +303,12 @@ const SectionFilterContent = ({
newFilter.withoutTags = false;
}
- // newFilter.withSubfolders = withSubfolders;
- // newFilter.searchInContent = withContent;
+ const path =
+ newFilter.searchArea === RoomSearchArea.Active
+ ? "rooms/shared"
+ : "rooms/archived";
- fetchRooms(selectedFolderId, newFilter).finally(() =>
- setIsLoading(false)
- );
+ navigate(`${path}/filter?${newFilter.toUrlParams()}`);
} else {
const filterType = getFilterType(data) || null;
@@ -342,24 +334,21 @@ const SectionFilterContent = ({
withSubfolders === FilterKeys.excludeSubfolders ? "false" : "true";
newFilter.searchInContent = withContent === "true" ? "true" : null;
- setIsLoading(true);
+ const path = location.pathname.split("/filter")[0];
- fetchFiles(selectedFolderId, newFilter).finally(() =>
- setIsLoading(false)
- );
+ navigate(`${path}/filter?${newFilter.toUrlParams()}`);
}
},
[
isRooms,
- fetchFiles,
- fetchRooms,
- fetchPeople,
+
setIsLoading,
roomsFilter,
accountsFilter,
filter,
- selectedFolderId,
+
isAccountsPage,
+ location.pathname,
]
);
@@ -367,82 +356,78 @@ const SectionFilterContent = ({
if (isAccountsPage) {
return;
}
-
+ setIsLoading(true);
if (isRooms) {
const newFilter = RoomsFilter.getDefault();
newFilter.searchArea = roomsFilter.searchArea;
- fetchRooms(selectedFolderId, newFilter).finally(() =>
- setIsLoading(false)
- );
+ const path =
+ roomsFilter.searchArea === RoomSearchArea.Active
+ ? "rooms/shared"
+ : "rooms/archived";
+
+ navigate(`${path}/filter?${newFilter.toUrlParams()}`);
} else {
const newFilter = filter.clone();
newFilter.page = 0;
newFilter.filterValue = "";
- setIsLoading(true);
+ const path = location.pathname.split("/filter")[0];
- fetchFiles(selectedFolderId, newFilter).finally(() => {
- setIsLoading(false);
- });
+ navigate(`${path}/filter?${newFilter.toUrlParams()}`);
}
}, [
isRooms,
setIsLoading,
- fetchFiles,
- fetchRooms,
- selectedFolderId,
filter,
roomsFilter,
isAccountsPage,
+
+ location.pathname,
]);
const onSearch = React.useCallback(
(data = "") => {
+ setIsLoading(true);
if (isAccountsPage) {
const newFilter = accountsFilter.clone();
newFilter.page = 0;
newFilter.search = data;
- setIsLoading(true);
-
- fetchPeople(newFilter, true).finally(() => setIsLoading(false));
+ navigate(`accounts/filter?${newFilter.toUrlParams()}`);
} else if (isRooms) {
const newFilter = roomsFilter.clone();
newFilter.page = 0;
newFilter.filterValue = data;
- setIsLoading(true);
+ const path =
+ newFilter.searchArea === RoomSearchArea.Active
+ ? "rooms/shared"
+ : "rooms/archived";
- fetchRooms(selectedFolderId, newFilter).finally(() =>
- setIsLoading(false)
- );
+ navigate(`${path}/filter?${newFilter.toUrlParams()}`);
} else {
const newFilter = filter.clone();
newFilter.page = 0;
newFilter.search = data;
- setIsLoading(true);
+ const path = location.pathname.split("/filter")[0];
- fetchFiles(selectedFolderId, newFilter).finally(() => {
- setIsLoading(false);
- });
+ navigate(`${path}/filter?${newFilter.toUrlParams()}`);
}
},
[
isRooms,
isAccountsPage,
setIsLoading,
- fetchFiles,
- fetchRooms,
- fetchPeople,
- selectedFolderId,
+
filter,
roomsFilter,
accountsFilter,
+ location.pathname,
]
);
@@ -463,29 +448,21 @@ const SectionFilterContent = ({
setIsLoading(true);
if (isAccountsPage) {
- fetchPeople(newFilter, true).finally(() => setIsLoading(false));
+ navigate(`accounts/filter?${newFilter.toUrlParams()}`);
} else if (isRooms) {
- fetchRooms(selectedFolderId, newFilter).finally(() =>
- setIsLoading(false)
- );
+ const path =
+ newFilter.searchArea === RoomSearchArea.Active
+ ? "rooms/shared"
+ : "rooms/archived";
+
+ navigate(`${path}/filter?${newFilter.toUrlParams()}`);
} else {
- fetchFiles(selectedFolderId, newFilter).finally(() =>
- setIsLoading(false)
- );
+ const path = location.pathname.split("/filter")[0];
+
+ navigate(`${path}/filter?${newFilter.toUrlParams()}`);
}
},
- [
- isRooms,
- isAccountsPage,
- setIsLoading,
- fetchFiles,
- fetchRooms,
- fetchPeople,
- selectedFolderId,
- filter,
- roomsFilter,
- accountsFilter,
- ]
+ [isRooms, isAccountsPage, setIsLoading, filter, roomsFilter, accountsFilter]
);
const onChangeViewAs = React.useCallback(
@@ -1748,6 +1725,7 @@ const SectionFilterContent = ({
const removeSelectedItem = React.useCallback(
({ key, group }) => {
+ setIsLoading(true);
if (isAccountsPage) {
const newFilter = accountsFilter.clone();
newFilter.page = 0;
@@ -1769,11 +1747,8 @@ const SectionFilterContent = ({
newFilter.payments = null;
}
- setIsLoading(true);
- fetchPeople(newFilter, true).finally(() => setIsLoading(false));
+ navigate(`accounts/filter?${newFilter.toUrlParams()}`);
} else if (isRooms) {
- setIsLoading(true);
-
const newFilter = roomsFilter.clone();
if (group === FilterGroups.roomFilterProviderType) {
@@ -1819,9 +1794,12 @@ const SectionFilterContent = ({
newFilter.page = 0;
- fetchRooms(selectedFolderId, newFilter).finally(() =>
- setIsLoading(false)
- );
+ const path =
+ newFilter.searchArea === RoomSearchArea.Active
+ ? "rooms/shared"
+ : "rooms/archived";
+
+ navigate(`${path}/filter?${newFilter.toUrlParams()}`);
} else {
const newFilter = filter.clone();
@@ -1841,25 +1819,12 @@ const SectionFilterContent = ({
newFilter.page = 0;
- setIsLoading(true);
+ const path = location.pathname.split("/filter")[0];
- fetchFiles(selectedFolderId, newFilter).finally(() =>
- setIsLoading(false)
- );
+ navigate(`${path}/filter?${newFilter.toUrlParams()}`);
}
},
- [
- isRooms,
- isAccountsPage,
- fetchFiles,
- fetchRooms,
- fetchPeople,
- setIsLoading,
- roomsFilter,
- filter,
- accountsFilter,
- selectedFolderId,
- ]
+ [isRooms, isAccountsPage, setIsLoading, roomsFilter, filter, accountsFilter]
);
const onSortButtonClick = (isOpen) => {
@@ -1869,25 +1834,30 @@ const SectionFilterContent = ({
};
const clearAll = () => {
+ setIsLoading(true);
if (isAccountsPage) {
- setIsLoading(true);
- fetchPeople(null, true).finally(() => setIsLoading(false));
- } else if (isRooms) {
- setIsLoading(true);
+ const newFilter = AccountsFilter.getDefault();
+ navigate(`accounts/filter?${newFilter.toUrlParams()}`);
+ } else if (isRooms) {
const newFilter = RoomsFilter.getDefault();
if (isArchiveFolder) {
newFilter.searchArea = RoomSearchArea.Archive;
}
- fetchRooms(selectedFolderId, newFilter).finally(() =>
- setIsLoading(false)
- );
- } else {
- setIsLoading(true);
+ const path =
+ newFilter.searchArea === RoomSearchArea.Active
+ ? "rooms/shared"
+ : "rooms/archived";
- fetchFiles(selectedFolderId).finally(() => setIsLoading(false));
+ navigate(`${path}/filter?${newFilter.toUrlParams()}`);
+ } else {
+ const newFilter = FilesFilter.getDefault();
+
+ const path = location.pathname.split("/filter")[0];
+
+ navigate(`${path}/filter?${newFilter.toUrlParams()}`);
}
};
@@ -1930,14 +1900,13 @@ export default inject(
auth,
filesStore,
treeFoldersStore,
- selectedFolderStore,
+
tagsStore,
peopleStore,
}) => {
const {
- fetchFiles,
filter,
- fetchRooms,
+
roomsFilter,
setIsLoading,
setViewAs,
@@ -1973,20 +1942,19 @@ export default inject(
const {
filterStore,
- usersStore,
+
groupsStore,
viewAs: accountsViewAs,
} = peopleStore;
const { groups } = groupsStore;
- const { getUsersList: fetchPeople } = usersStore;
const { filter: accountsFilter } = filterStore;
return {
user,
userId: user.id,
- selectedFolderId: selectedFolderStore.id,
+
selectedItem: filter.selectedItem,
filter,
roomsFilter,
@@ -1999,8 +1967,7 @@ export default inject(
isArchiveFolder,
setIsLoading,
- fetchFiles,
- fetchRooms,
+
fetchTags,
setViewAs,
createThumbnails,
@@ -2023,7 +1990,7 @@ export default inject(
accountsViewAs,
groups,
- fetchPeople,
+
accountsFilter,
};
}
diff --git a/packages/client/src/pages/Home/index.js b/packages/client/src/pages/Home/index.js
index f1825ec49e..3bc930c352 100644
--- a/packages/client/src/pages/Home/index.js
+++ b/packages/client/src/pages/Home/index.js
@@ -100,7 +100,6 @@ const PureHome = (props) => {
frameConfig,
withPaging,
isEmptyPage,
- isLoadedEmptyPage,
setPortalTariff,
@@ -164,14 +163,16 @@ const PureHome = (props) => {
t,
isAccountsPage,
location,
+
setIsLoading,
+ setFirstLoad,
setSelectedNode,
fetchPeople,
setPortalTariff,
});
- useSettings({ t, isSettingsPage, location });
+ useSettings({ t, isSettingsPage, setFirstLoad, setIsLoading });
useSDK({
frameConfig,
@@ -341,7 +342,7 @@ export default inject(
refreshFiles,
setViewAs,
isEmptyPage,
- isLoadedEmptyPage,
+
disableDrag,
isErrorRoomNotAvailable,
setIsPreview,
@@ -488,7 +489,7 @@ export default inject(
setViewAs,
withPaging,
isEmptyPage,
- isLoadedEmptyPage,
+
setPortalTariff,
accountsViewAs,
diff --git a/packages/client/src/store/FilesStore.js b/packages/client/src/store/FilesStore.js
index 1a14571296..28d8d0685e 100644
--- a/packages/client/src/store/FilesStore.js
+++ b/packages/client/src/store/FilesStore.js
@@ -2573,7 +2573,6 @@ class FilesStore {
const items = [...newFolders, ...this.files];
if (items.length > 0 && this.isEmptyPage) {
- console.log("set false");
this.setIsEmptyPage(false);
}