Skip to content

Commit 22bb3c5

Browse files
[WEB-5490] fix: intake section filter persists incorrectly across projects (#8187)
1 parent 6b85d67 commit 22bb3c5

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

apps/web/core/components/inbox/root.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { FC } from "react";
21
import { useEffect, useState } from "react";
32
import { observer } from "mobx-react";
43
import { PanelLeft } from "lucide-react";
@@ -30,12 +29,17 @@ export const InboxIssueRoot = observer(function InboxIssueRoot(props: TInboxIssu
3029
// plane hooks
3130
const { t } = useTranslation();
3231
// hooks
33-
const { loader, error, currentTab, handleCurrentTab, fetchInboxIssues } = useProjectInbox();
32+
const { loader, error, currentTab, currentInboxProjectId, handleCurrentTab, fetchInboxIssues } = useProjectInbox();
3433

3534
useEffect(() => {
3635
if (!inboxAccessible || !workspaceSlug || !projectId) return;
36+
// Check if project has changed
37+
const hasProjectChanged = currentInboxProjectId && currentInboxProjectId !== projectId;
38+
3739
if (navigationTab && navigationTab !== currentTab) {
3840
handleCurrentTab(workspaceSlug, projectId, navigationTab);
41+
} else if (hasProjectChanged) {
42+
handleCurrentTab(workspaceSlug, projectId, EInboxIssueCurrentTab.OPEN);
3943
} else {
4044
fetchInboxIssues(
4145
workspaceSlug.toString(),

apps/web/core/components/inbox/sidebar/root.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { FC } from "react";
21
import { useCallback, useEffect, useRef, useState } from "react";
32
import { observer } from "mobx-react";
43
import { useTranslation } from "@plane/i18n";

apps/web/core/store/inbox/project-inbox.store.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,18 +125,16 @@ export class ProjectInboxStore implements IProjectInboxStore {
125125
* @description computed project inbox filters
126126
*/
127127
get inboxFilters() {
128-
const { projectId } = this.store.router;
129-
if (!projectId) return {} as TInboxIssueFilter;
130-
return this.filtersMap?.[projectId];
128+
if (!this.currentInboxProjectId) return {} as TInboxIssueFilter;
129+
return this.filtersMap?.[this.currentInboxProjectId];
131130
}
132131

133132
/**
134133
* @description computed project inbox sorting
135134
*/
136135
get inboxSorting() {
137-
const { projectId } = this.store.router;
138-
if (!projectId) return {} as TInboxIssueSorting;
139-
return this.sortingMap?.[projectId];
136+
if (!this.currentInboxProjectId) return {} as TInboxIssueSorting;
137+
return this.sortingMap?.[this.currentInboxProjectId];
140138
}
141139

142140
get getAppliedFiltersCount() {
@@ -274,7 +272,8 @@ export class ProjectInboxStore implements IProjectInboxStore {
274272
};
275273

276274
handleInboxIssueFilters = <T extends keyof TInboxIssueFilter>(key: T, value: TInboxIssueFilter[T]) => {
277-
const { workspaceSlug, projectId } = this.store.router;
275+
const { workspaceSlug } = this.store.router;
276+
const projectId = this.currentInboxProjectId;
278277
if (workspaceSlug && projectId) {
279278
runInAction(() => {
280279
set(this.filtersMap, [projectId, key], value);
@@ -285,7 +284,8 @@ export class ProjectInboxStore implements IProjectInboxStore {
285284
};
286285

287286
handleInboxIssueSorting = <T extends keyof TInboxIssueSorting>(key: T, value: TInboxIssueSorting[T]) => {
288-
const { workspaceSlug, projectId } = this.store.router;
287+
const { workspaceSlug } = this.store.router;
288+
const projectId = this.currentInboxProjectId;
289289
if (workspaceSlug && projectId) {
290290
runInAction(() => {
291291
set(this.sortingMap, [projectId, key], value);

0 commit comments

Comments
 (0)