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

View File

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