From 5f9796b7765604217532fe28253322a9db67857f Mon Sep 17 00:00:00 2001 From: Andrey Mikhadyuk Date: Tue, 12 Sep 2023 16:41:44 +0300 Subject: [PATCH] use rootCommonId in root common member fetch --- src/pages/commonFeed/hooks/useCommonData/index.ts | 8 +++++--- src/shared/models/Common.tsx | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/pages/commonFeed/hooks/useCommonData/index.ts b/src/pages/commonFeed/hooks/useCommonData/index.ts index 23d1caef3c..910cf37bdb 100644 --- a/src/pages/commonFeed/hooks/useCommonData/index.ts +++ b/src/pages/commonFeed/hooks/useCommonData/index.ts @@ -63,13 +63,15 @@ export const useCommonData = (userId?: string): Return => { ); } - const rootCommonId = common.directParent?.commonId; const [parentCommons, subCommons, rootCommonMember] = await Promise.all([ CommonService.getAllParentCommonsForCommon(common), CommonService.getCommonsByDirectParentIds([common.id]), - rootCommonId && userId - ? CommonService.getCommonMemberByUserId(rootCommonId, userId) + common.rootCommonId && userId + ? CommonService.getCommonMemberByUserId( + common.rootCommonId, + userId, + ) : null, ]); diff --git a/src/shared/models/Common.tsx b/src/shared/models/Common.tsx index 0925381b9f..33743e81df 100644 --- a/src/shared/models/Common.tsx +++ b/src/shared/models/Common.tsx @@ -115,6 +115,8 @@ export interface Common extends BaseEntity { messages?: DiscussionMessage[]; pinnedFeedItems: FeedItem[]; + + rootCommonId?: string; } export interface Project extends Common {