[WEB-5064] fix: peek overview reloading when parent is added (#7950)
This commit is contained in:
parent
12a050e7d3
commit
8853637e98
1 changed files with 12 additions and 7 deletions
|
|
@ -1,10 +1,11 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import type { FC } from "react";
|
import type { FC } from "react";
|
||||||
import { useEffect, useState, useMemo, useCallback } from "react";
|
import { useState, useMemo, useCallback } from "react";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { usePathname } from "next/navigation";
|
import { usePathname } from "next/navigation";
|
||||||
// Plane imports
|
// Plane imports
|
||||||
|
import useSWR from "swr";
|
||||||
import { EUserPermissions, EUserPermissionsLevel, WORK_ITEM_TRACKER_EVENTS } from "@plane/constants";
|
import { EUserPermissions, EUserPermissionsLevel, WORK_ITEM_TRACKER_EVENTS } from "@plane/constants";
|
||||||
import { useTranslation } from "@plane/i18n";
|
import { useTranslation } from "@plane/i18n";
|
||||||
import { TOAST_TYPE, setPromiseToast, setToast } from "@plane/propel/toast";
|
import { TOAST_TYPE, setPromiseToast, setToast } from "@plane/propel/toast";
|
||||||
|
|
@ -40,7 +41,7 @@ export const IssuePeekOverview: FC<IWorkItemPeekOverview> = observer((props) =>
|
||||||
const {
|
const {
|
||||||
peekIssue,
|
peekIssue,
|
||||||
setPeekIssue,
|
setPeekIssue,
|
||||||
issue: { fetchIssue, getIsFetchingIssueDetails },
|
issue: { fetchIssue },
|
||||||
fetchActivities,
|
fetchActivities,
|
||||||
} = useIssueDetail();
|
} = useIssueDetail();
|
||||||
const issueStoreType = useIssueStoreType();
|
const issueStoreType = useIssueStoreType();
|
||||||
|
|
@ -283,11 +284,15 @@ export const IssuePeekOverview: FC<IWorkItemPeekOverview> = observer((props) =>
|
||||||
[fetchIssue, is_draft, issues, fetchActivities, pathname, removeRoutePeekId, restoreIssue]
|
[fetchIssue, is_draft, issues, fetchActivities, pathname, removeRoutePeekId, restoreIssue]
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
const { isLoading } = useSWR(
|
||||||
if (peekIssue) {
|
["peek-issue", peekIssue?.workspaceSlug, peekIssue?.projectId, peekIssue?.issueId],
|
||||||
issueOperations.fetch(peekIssue.workspaceSlug, peekIssue.projectId, peekIssue.issueId);
|
() => peekIssue && issueOperations.fetch(peekIssue.workspaceSlug, peekIssue.projectId, peekIssue.issueId),
|
||||||
|
{
|
||||||
|
revalidateIfStale: false,
|
||||||
|
revalidateOnFocus: false,
|
||||||
|
revalidateOnReconnect: false,
|
||||||
}
|
}
|
||||||
}, [peekIssue, issueOperations]);
|
);
|
||||||
|
|
||||||
if (!peekIssue?.workspaceSlug || !peekIssue?.projectId || !peekIssue?.issueId) return <></>;
|
if (!peekIssue?.workspaceSlug || !peekIssue?.projectId || !peekIssue?.issueId) return <></>;
|
||||||
|
|
||||||
|
|
@ -304,7 +309,7 @@ export const IssuePeekOverview: FC<IWorkItemPeekOverview> = observer((props) =>
|
||||||
workspaceSlug={peekIssue.workspaceSlug}
|
workspaceSlug={peekIssue.workspaceSlug}
|
||||||
projectId={peekIssue.projectId}
|
projectId={peekIssue.projectId}
|
||||||
issueId={peekIssue.issueId}
|
issueId={peekIssue.issueId}
|
||||||
isLoading={getIsFetchingIssueDetails(peekIssue.issueId)}
|
isLoading={isLoading}
|
||||||
isError={error}
|
isError={error}
|
||||||
is_archived={!!peekIssue.isArchived}
|
is_archived={!!peekIssue.isArchived}
|
||||||
disabled={!isEditable}
|
disabled={!isEditable}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue