π₯π₯π₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.
TypeScript boardsbug-trackerdjangodockerganttissue-trackerjirajira-alternativekanbanlinearpostgresqlproduct-managementproject-managementproject-planningpythonreactredistypesciptvitework-management
fix peek overview loading state (#5698)
rahulramesha6e0ece496ad6
diff --git a/web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/archives/issues/(detail)/[archivedIssueId]/page.tsx b/web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/archives/issues/(detail)/[archivedIssueId]/page.tsxindex 69d24b167b..11e9831b3a 100644--- a/web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/archives/issues/(detail)/[archivedIssueId]/page.tsx+++ b/web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/archives/issues/(detail)/[archivedIssueId]/page.tsx@@ -19,7 +19,7 @@ const ArchivedIssueDetailsPage = observer(() => {// hooksconst {fetchIssue,- issue: { getIssueById, isFetchingIssueDetails },+ issue: { getIssueById, getIsFetchingIssueDetails },} = useIssueDetail();const { getProjectById } = useProject();@@ -40,7 +40,7 @@ const ArchivedIssueDetailsPage = observer(() => {if (!issue) return <></>;- const issueLoader = !issue || isFetchingIssueDetails ? true : false;+ const issueLoader = !issue || getIsFetchingIssueDetails(issue?.id) ? true : false;return (<>diff --git a/web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/issues/(detail)/[issueId]/page.tsx b/web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/issues/(detail)/[issueId]/page.tsxindex 7956c96fb8..1aa2270039 100644--- a/web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/issues/(detail)/[issueId]/page.tsx+++ b/web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/issues/(detail)/[issueId]/page.tsx@@ -27,7 +27,7 @@ const IssueDetailsPage = observer(() => {// store hooksconst {fetchIssue,- issue: { getIssueById, isFetchingIssueDetails },+ issue: { getIssueById, getIsFetchingIssueDetails },} = useIssueDetail();const { getProjectById } = useProject();const { toggleIssueDetailSidebar, issueDetailSidebarCollapsed } = useAppTheme();@@ -41,7 +41,7 @@ const IssueDetailsPage = observer(() => {// derived valuesconst issue = getIssueById(issueId?.toString() || "") || undefined;const project = (issue?.project_id && getProjectById(issue?.project_id)) || undefined;- const issueLoader = !issue || isFetchingIssueDetails ? true : false;+ const issueLoader = !issue || getIsFetchingIssueDetails(issue?.id) ? true : false;const pageTitle = project && issue ? `${project?.identifier}-${issue?.sequence_id} ${issue?.name}` : undefined;useEffect(() => {diff --git a/web/core/components/issues/peek-overview/root.tsx b/web/core/components/issues/peek-overview/root.tsxindex 0283585d53..7ac5cd50c6 100644--- a/web/core/components/issues/peek-overview/root.tsx+++ b/web/core/components/issues/peek-overview/root.tsx@@ -35,7 +35,7 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {const {peekIssue,setPeekIssue,- issue: { fetchIssue, isFetchingIssueDetails },+ issue: { fetchIssue, getIsFetchingIssueDetails },fetchActivities,} = useIssueDetail();@@ -344,7 +344,7 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {workspaceSlug={peekIssue.workspaceSlug}projectId={peekIssue.projectId}issueId={peekIssue.issueId}- isLoading={isFetchingIssueDetails}+ isLoading={getIsFetchingIssueDetails(peekIssue.issueId)}isError={error}is_archived={is_archived}disabled={!isEditable}diff --git a/web/core/components/issues/peek-overview/view.tsx b/web/core/components/issues/peek-overview/view.tsxindex 7bc63c00c0..959592fcc6 100644--- a/web/core/components/issues/peek-overview/view.tsx+++ b/web/core/components/issues/peek-overview/view.tsx@@ -60,7 +60,7 @@ export const IssueView: FC<IIssueView> = observer((props) => {isArchiveIssueModalOpen,toggleDeleteIssueModal,toggleArchiveIssueModal,- issue: { getIssueById, isLocalDBIssueDescription },+ issue: { getIssueById, getIsLocalDBIssueDescription },} = useIssueDetail();const issue = getIssueById(issueId);// remove peek id@@ -69,6 +69,8 @@ export const IssueView: FC<IIssueView> = observer((props) => {if (embedIssue) embedRemoveCurrentNotification && embedRemoveCurrentNotification();};+ const isLocalDBIssueDescription = getIsLocalDBIssueDescription(issueId);+usePeekOverviewOutsideClickDetector(issuePeekOverviewRef,() => {diff --git a/web/core/store/issue/issue-details/issue.store.ts b/web/core/store/issue/issue-details/issue.store.tsindex 8833b6ea11..dd1f21a4e0 100644--- a/web/core/store/issue/issue-details/issue.store.ts+++ b/web/core/store/issue/issue-details/issue.store.ts@@ -34,15 +34,15 @@ export interface IIssueStoreActions {}export interface IIssueStore extends IIssueStoreActions {- isFetchingIssueDetails: boolean;- isLocalDBIssueDescription: boolean;+ getIsFetchingIssueDetails: (issueId: string | undefined) => boolean;+ getIsLocalDBIssueDescription: (issueId: string | undefined) => boolean;// helper methodsgetIssueById: (issueId: string) => TIssue | undefined;}export class IssueStore implements IIssueStore {- isFetchingIssueDetails: boolean = false;- isLocalDBIssueDescription: boolean = false;+ fetchingIssueDetails: string | undefined = undefined;+ localDBIssueDescription: string | undefined = undefined;// root storerootIssueDetailStore: IIssueDetail;// services@@ -52,7 +52,8 @@ export class IssueStore implements IIssueStore {constructor(rootStore: IIssueDetail) {makeObservable(this, {- isFetchingIssueDetails: observable.ref,+ fetchingIssueDetails: observable.ref,+ localDBIssueDescription: observable.ref,});// root storethis.rootIssueDetailStore = rootStore;@@ -62,6 +63,18 @@ export class IssueStore implements IIssueStore {this.issueDraftService = new IssueDraftService();}+ getIsFetchingIssueDetails = computedFn((issueId: string | undefined) => {+ if (!issueId) return false;++ return this.fetchingIssueDetails === issueId;+ });++ getIsLocalDBIssueDescription = computedFn((issueId: string | undefined) => {+ if (!issueId) return false;++ return this.localDBIssueDescription === issueId;+ });+// helper methodsgetIssueById = computedFn((issueId: string) => {if (!issueId) return undefined;@@ -79,11 +92,11 @@ export class IssueStore implements IIssueStore {// fetch issue from local dbissue = await persistence.getIssue(issueId);- this.isFetchingIssueDetails = true;+ this.fetchingIssueDetails = issueId;if (issue) {this.addIssueToStore(issue);- this.isLocalDBIssueDescription = true;+ this.localDBIssueDescription = issueId;}if (issueType === "ARCHIVED")@@ -95,7 +108,7 @@ export class IssueStore implements IIssueStore {if (!issue) throw new Error("Issue not found");const issuePayload = this.addIssueToStore(issue);- this.isLocalDBIssueDescription = false;+ this.localDBIssueDescription = undefined;this.rootIssueDetailStore.rootIssueStore.issues.addIssue([issuePayload]);@@ -173,7 +186,7 @@ export class IssueStore implements IIssueStore {};this.rootIssueDetailStore.rootIssueStore.issues.addIssue([issuePayload]);- this.isFetchingIssueDetails = false;+ this.fetchingIssueDetails = undefined;return issuePayload;};