Client: Fixed crash in public room

This commit is contained in:
Akmal Isomadinov 2024-08-29 20:19:44 +05:00
parent ee7fe469b2
commit f3c183b800
2 changed files with 12 additions and 7 deletions

View File

@ -133,9 +133,9 @@ export const useOptions = (
newFilter.searchArea = RoomSearchArea.Active; newFilter.searchArea = RoomSearchArea.Active;
const state = { const state = {
title: roomsFolder.title, title: roomsFolder?.title,
isRoot: true, isRoot: true,
rootFolderType: roomsFolder.rootFolderType, rootFolderType: roomsFolder?.rootFolderType,
}; };
const path = getCategoryUrl(CategoryType.Shared); const path = getCategoryUrl(CategoryType.Shared);
@ -146,7 +146,7 @@ export const useOptions = (
}, },
state, state,
}; };
}, [roomsFolder.rootFolderType, roomsFolder.title, userId]); }, [roomsFolder?.rootFolderType, roomsFolder?.title, userId]);
const onGoToPersonal = useCallback((): LinkProps => { const onGoToPersonal = useCallback((): LinkProps => {
const newFilter = FilesFilter.getDefault(); const newFilter = FilesFilter.getDefault();
@ -154,9 +154,9 @@ export const useOptions = (
newFilter.folder = myFolderId?.toString() ?? ""; newFilter.folder = myFolderId?.toString() ?? "";
const state = { const state = {
title: myFolder.title, title: myFolder?.title,
isRoot: true, isRoot: true,
rootFolderType: myFolder.rootFolderType, rootFolderType: myFolder?.rootFolderType,
}; };
const path = getCategoryUrl(CategoryType.Personal); const path = getCategoryUrl(CategoryType.Personal);
@ -170,7 +170,7 @@ export const useOptions = (
}, },
state, state,
}; };
}, [myFolder.rootFolderType, myFolder.title, myFolderId]); }, [myFolder?.rootFolderType, myFolder?.title, myFolderId]);
const onCreateRoom = useCallback(() => { const onCreateRoom = useCallback(() => {
if (isWarningRoomsDialog) { if (isWarningRoomsDialog) {

View File

@ -179,6 +179,9 @@ class TreeFoldersStore {
return this.rootFoldersTitles[FolderType.TRASH]?.id; return this.rootFoldersTitles[FolderType.TRASH]?.id;
} }
/**
* @type {import("@docspace/shared/api/files/types").TFolder=}
*/
get myFolder() { get myFolder() {
return this.treeFolders.find((x) => x.rootFolderType === FolderType.USER); return this.treeFolders.find((x) => x.rootFolderType === FolderType.USER);
} }
@ -196,7 +199,9 @@ class TreeFoldersStore {
get recentFolder() { get recentFolder() {
return this.treeFolders.find((x) => x.rootFolderType === FolderType.Recent); return this.treeFolders.find((x) => x.rootFolderType === FolderType.Recent);
} }
/**
* @type {import("@docspace/shared/api/rooms/types").TRoom=}
*/
get roomsFolder() { get roomsFolder() {
return this.treeFolders.find((x) => x.rootFolderType === FolderType.Rooms); return this.treeFolders.find((x) => x.rootFolderType === FolderType.Rooms);
} }