Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

[WEB-5490] fix: intake section filter persists incorrectly across projects (#8187)

b-saikrishnakanth22bb3c5eccb4
diff --git a/apps/web/core/components/inbox/root.tsx b/apps/web/core/components/inbox/root.tsx
index 429918f67c..088fb8db24 100644
--- a/apps/web/core/components/inbox/root.tsx
+++ b/apps/web/core/components/inbox/root.tsx
@@ -1,4 +1,3 @@
-import type { FC } from "react";
import { useEffect, useState } from "react";
import { observer } from "mobx-react";
import { PanelLeft } from "lucide-react";
@@ -30,12 +29,17 @@ export const InboxIssueRoot = observer(function InboxIssueRoot(props: TInboxIssu
// plane hooks
const { t } = useTranslation();
// hooks
- const { loader, error, currentTab, handleCurrentTab, fetchInboxIssues } = useProjectInbox();
+ const { loader, error, currentTab, currentInboxProjectId, handleCurrentTab, fetchInboxIssues } = useProjectInbox();
useEffect(() => {
if (!inboxAccessible || !workspaceSlug || !projectId) return;
+ // Check if project has changed
+ const hasProjectChanged = currentInboxProjectId && currentInboxProjectId !== projectId;
+
if (navigationTab && navigationTab !== currentTab) {
handleCurrentTab(workspaceSlug, projectId, navigationTab);
+ } else if (hasProjectChanged) {
+ handleCurrentTab(workspaceSlug, projectId, EInboxIssueCurrentTab.OPEN);
} else {
fetchInboxIssues(
workspaceSlug.toString(),
diff --git a/apps/web/core/components/inbox/sidebar/root.tsx b/apps/web/core/components/inbox/sidebar/root.tsx
index 027edfa76e..06c311821f 100644
--- a/apps/web/core/components/inbox/sidebar/root.tsx
+++ b/apps/web/core/components/inbox/sidebar/root.tsx
@@ -1,4 +1,3 @@
-import type { FC } from "react";
import { useCallback, useEffect, useRef, useState } from "react";
import { observer } from "mobx-react";
import { useTranslation } from "@plane/i18n";
diff --git a/apps/web/core/store/inbox/project-inbox.store.ts b/apps/web/core/store/inbox/project-inbox.store.ts
index b5e659361c..e1a84965a2 100644
--- a/apps/web/core/store/inbox/project-inbox.store.ts
+++ b/apps/web/core/store/inbox/project-inbox.store.ts
@@ -125,18 +125,16 @@ export class ProjectInboxStore implements IProjectInboxStore {
* @description computed project inbox filters
*/
get inboxFilters() {
- const { projectId } = this.store.router;
- if (!projectId) return {} as TInboxIssueFilter;
- return this.filtersMap?.[projectId];
+ if (!this.currentInboxProjectId) return {} as TInboxIssueFilter;
+ return this.filtersMap?.[this.currentInboxProjectId];
}
/**
* @description computed project inbox sorting
*/
get inboxSorting() {
- const { projectId } = this.store.router;
- if (!projectId) return {} as TInboxIssueSorting;
- return this.sortingMap?.[projectId];
+ if (!this.currentInboxProjectId) return {} as TInboxIssueSorting;
+ return this.sortingMap?.[this.currentInboxProjectId];
}
get getAppliedFiltersCount() {
@@ -274,7 +272,8 @@ export class ProjectInboxStore implements IProjectInboxStore {
};
handleInboxIssueFilters = <T extends keyof TInboxIssueFilter>(key: T, value: TInboxIssueFilter[T]) => {
- const { workspaceSlug, projectId } = this.store.router;
+ const { workspaceSlug } = this.store.router;
+ const projectId = this.currentInboxProjectId;
if (workspaceSlug && projectId) {
runInAction(() => {
set(this.filtersMap, [projectId, key], value);
@@ -285,7 +284,8 @@ export class ProjectInboxStore implements IProjectInboxStore {
};
handleInboxIssueSorting = <T extends keyof TInboxIssueSorting>(key: T, value: TInboxIssueSorting[T]) => {
- const { workspaceSlug, projectId } = this.store.router;
+ const { workspaceSlug } = this.store.router;
+ const projectId = this.currentInboxProjectId;
if (workspaceSlug && projectId) {
runInAction(() => {
set(this.sortingMap, [projectId, key], value);