Skip to content

Commit 256ee5a

Browse files
prateekshourya29lifeiscontent
authored andcommitted
fix: command modal mutation (#6641)
* fix: command modal mutation * chore: minor update
1 parent 99849d9 commit 256ee5a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

web/core/components/command-palette/command-modal.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,26 +67,29 @@ export const CommandModal: React.FC = observer(() => {
6767
// plane hooks
6868
const { t } = useTranslation();
6969
// hooks
70-
const { fetchIssueWithIdentifier } = useIssueDetail();
70+
const {
71+
issue: { getIssueById },
72+
fetchIssueWithIdentifier,
73+
} = useIssueDetail();
7174
const { workspaceProjectIds } = useProject();
7275
const { platform, isMobile } = usePlatformOS();
7376
const { canPerformAnyCreateAction } = useUser();
7477
const { isCommandPaletteOpen, toggleCommandPaletteModal, toggleCreateIssueModal, toggleCreateProjectModal } =
7578
useCommandPalette();
7679
const { allowPermissions } = useUserPermissions();
7780
const { setTrackElement } = useEventTracker();
78-
7981
const projectIdentifier = workItem?.toString().split("-")[0];
8082
const sequence_id = workItem?.toString().split("-")[1];
81-
82-
const { data: issueDetails } = useSWR(
83+
// fetch work item details using identifier
84+
const { data: workItemDetailsSWR } = useSWR(
8385
workspaceSlug && workItem ? `ISSUE_DETAIL_${workspaceSlug}_${projectIdentifier}_${sequence_id}` : null,
8486
workspaceSlug && workItem
8587
? () => fetchIssueWithIdentifier(workspaceSlug.toString(), projectIdentifier, sequence_id)
8688
: null
8789
);
8890

8991
// derived values
92+
const issueDetails = workItemDetailsSWR ? getIssueById(workItemDetailsSWR?.id) : null;
9093
const issueId = issueDetails?.id;
9194
const projectId = issueDetails?.project_id;
9295
const page = pages[pages.length - 1];

0 commit comments

Comments
 (0)