Skip to content

The open alternative to Salesforce, designed for AI.

Fix right drawer bug (#584)

Charles Bochete1161e96a9f9
diff --git a/front/src/modules/comments/components/comment-thread/CommentThreadComments.tsx b/front/src/modules/comments/components/comment-thread/CommentThreadComments.tsx
index 0e4d68a2ff3..38c794f0318 100644
--- a/front/src/modules/comments/components/comment-thread/CommentThreadComments.tsx
+++ b/front/src/modules/comments/components/comment-thread/CommentThreadComments.tsx
@@ -4,7 +4,7 @@ import { useRecoilValue } from 'recoil';
import { v4 } from 'uuid';
import { currentUserState } from '@/auth/states/currentUserState';
-import { GET_COMMENT_THREADS_BY_TARGETS } from '@/comments/services';
+import { GET_COMMENT_THREAD } from '@/comments/services';
import { CommentForDrawer } from '@/comments/types/CommentForDrawer';
import { AutosizeTextInput } from '@/ui/components/inputs/AutosizeTextInput';
import { isNonEmptyString } from '@/utils/type-guards/isNonEmptyString';
@@ -69,7 +69,7 @@ export function CommentThreadComments({ commentThread }: OwnProps) {
commentText: commentText,
createdAt: new Date().toISOString(),
},
- refetchQueries: [getOperationName(GET_COMMENT_THREADS_BY_TARGETS) ?? ''],
+ refetchQueries: [getOperationName(GET_COMMENT_THREAD) ?? ''],
});
}
diff --git a/front/src/modules/comments/hooks/useOpenCommentThreadRightDrawer.ts b/front/src/modules/comments/hooks/useOpenCommentThreadRightDrawer.ts
index f7254b40cb4..6e6d17e0968 100644
--- a/front/src/modules/comments/hooks/useOpenCommentThreadRightDrawer.ts
+++ b/front/src/modules/comments/hooks/useOpenCommentThreadRightDrawer.ts
@@ -1,5 +1,7 @@
import { useRecoilState } from 'recoil';
+import { useSetHotkeysScope } from '@/hotkeys/hooks/useSetHotkeysScope';
+import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope';
import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
import { useOpenRightDrawer } from '../../ui/layout/right-drawer/hooks/useOpenRightDrawer';
@@ -10,8 +12,10 @@ export function useOpenCommentThreadRightDrawer() {
const [, setViewableCommentThreadId] = useRecoilState(
viewableCommentThreadIdState,
);
+ const setHotkeysScope = useSetHotkeysScope();
return function openCommentThreadRightDrawer(commentThreadId: string) {
+ setHotkeysScope(InternalHotkeysScope.RightDrawer, { goto: false });
setViewableCommentThreadId(commentThreadId);
openRightDrawer(RightDrawerPages.EditCommentThread);
};
diff --git a/front/src/modules/comments/hooks/useOpenCreateCommentDrawerForSelectedRowIds.ts b/front/src/modules/comments/hooks/useOpenCreateCommentDrawerForSelectedRowIds.ts
index 5bf8dc5eff1..7a5fe26c219 100644
--- a/front/src/modules/comments/hooks/useOpenCreateCommentDrawerForSelectedRowIds.ts
+++ b/front/src/modules/comments/hooks/useOpenCreateCommentDrawerForSelectedRowIds.ts
@@ -4,6 +4,8 @@ import { v4 } from 'uuid';
import { currentUserState } from '@/auth/states/currentUserState';
import { GET_COMPANIES } from '@/companies/services';
+import { useSetHotkeysScope } from '@/hotkeys/hooks/useSetHotkeysScope';
+import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope';
import { GET_PEOPLE } from '@/people/services';
import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
import { selectedRowIdsState } from '@/ui/tables/states/selectedRowIdsState';
@@ -28,6 +30,7 @@ export function useOpenCreateCommentThreadDrawerForSelectedRowIds() {
const [, setViewableCommentThreadId] = useRecoilState(
viewableCommentThreadIdState,
);
+ const setHotkeysScope = useSetHotkeysScope();
const [, setCommentableEntityArray] = useRecoilState(
commentableEntityArrayState,
@@ -64,6 +67,7 @@ export function useOpenCreateCommentThreadDrawerForSelectedRowIds() {
getOperationName(GET_COMMENT_THREADS_BY_TARGETS) ?? '',
],
onCompleted(data) {
+ setHotkeysScope(InternalHotkeysScope.RightDrawer, { goto: false });
setViewableCommentThreadId(data.createOneCommentThread.id);
setCommentableEntityArray(commentableEntityArray);
openRightDrawer(RightDrawerPages.CreateCommentThread);
diff --git a/front/src/modules/comments/hooks/useOpenCreateCommentThreadDrawer.ts b/front/src/modules/comments/hooks/useOpenCreateCommentThreadDrawer.ts
index 1447f34342c..53d5881c552 100644
--- a/front/src/modules/comments/hooks/useOpenCreateCommentThreadDrawer.ts
+++ b/front/src/modules/comments/hooks/useOpenCreateCommentThreadDrawer.ts
@@ -4,6 +4,8 @@ import { v4 } from 'uuid';
import { currentUserState } from '@/auth/states/currentUserState';
import { GET_COMPANIES } from '@/companies/services';
+import { useSetHotkeysScope } from '@/hotkeys/hooks/useSetHotkeysScope';
+import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope';
import { GET_PEOPLE } from '@/people/services';
import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
import { useCreateCommentThreadMutation } from '~/generated/graphql';
@@ -21,6 +23,7 @@ export function useOpenCreateCommentThreadDrawer() {
const openRightDrawer = useOpenRightDrawer();
const [createCommentThreadMutation] = useCreateCommentThreadMutation();
const currentUser = useRecoilValue(currentUserState);
+ const setHotkeysScope = useSetHotkeysScope();
const [, setCommentableEntityArray] = useRecoilState(
commentableEntityArrayState,
@@ -51,6 +54,7 @@ export function useOpenCreateCommentThreadDrawer() {
getOperationName(GET_COMMENT_THREADS_BY_TARGETS) ?? '',
],
onCompleted(data) {
+ setHotkeysScope(InternalHotkeysScope.RightDrawer, { goto: false });
setViewableCommentThreadId(data.createOneCommentThread.id);
setCommentableEntityArray([entity]);
openRightDrawer(RightDrawerPages.CreateCommentThread);
diff --git a/front/src/modules/comments/hooks/useOpenTimelineRightDrawer.ts b/front/src/modules/comments/hooks/useOpenTimelineRightDrawer.ts
index b9edffcf344..2ebfbdf57c7 100644
--- a/front/src/modules/comments/hooks/useOpenTimelineRightDrawer.ts
+++ b/front/src/modules/comments/hooks/useOpenTimelineRightDrawer.ts
@@ -1,5 +1,7 @@
import { useRecoilState } from 'recoil';
+import { useSetHotkeysScope } from '@/hotkeys/hooks/useSetHotkeysScope';
+import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope';
import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
import { useOpenRightDrawer } from '../../ui/layout/right-drawer/hooks/useOpenRightDrawer';
@@ -11,10 +13,12 @@ export function useOpenTimelineRightDrawer() {
const [, setCommentableEntityArray] = useRecoilState(
commentableEntityArrayState,
);
+ const setHotkeysScope = useSetHotkeysScope();
return function openTimelineRightDrawer(
commentableEntityArray: CommentableEntity[],
) {
+ setHotkeysScope(InternalHotkeysScope.RightDrawer, { goto: false });
setCommentableEntityArray(commentableEntityArray);
openRightDrawer(RightDrawerPages.Timeline);
};