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

This commit is contained in:
b-saikrishnakanth 2025-12-01 12:49:05 +05:30 committed by GitHub
parent 6b85d67f6c
commit 22bb3c5ecc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 11 deletions

View file

@ -1,4 +1,3 @@
import type { FC } from "react";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import { PanelLeft } from "lucide-react"; import { PanelLeft } from "lucide-react";
@ -30,12 +29,17 @@ export const InboxIssueRoot = observer(function InboxIssueRoot(props: TInboxIssu
// plane hooks // plane hooks
const { t } = useTranslation(); const { t } = useTranslation();
// hooks // hooks
const { loader, error, currentTab, handleCurrentTab, fetchInboxIssues } = useProjectInbox(); const { loader, error, currentTab, currentInboxProjectId, handleCurrentTab, fetchInboxIssues } = useProjectInbox();
useEffect(() => { useEffect(() => {
if (!inboxAccessible || !workspaceSlug || !projectId) return; if (!inboxAccessible || !workspaceSlug || !projectId) return;
// Check if project has changed
const hasProjectChanged = currentInboxProjectId && currentInboxProjectId !== projectId;
if (navigationTab && navigationTab !== currentTab) { if (navigationTab && navigationTab !== currentTab) {
handleCurrentTab(workspaceSlug, projectId, navigationTab); handleCurrentTab(workspaceSlug, projectId, navigationTab);
} else if (hasProjectChanged) {
handleCurrentTab(workspaceSlug, projectId, EInboxIssueCurrentTab.OPEN);
} else { } else {
fetchInboxIssues( fetchInboxIssues(
workspaceSlug.toString(), workspaceSlug.toString(),

View file

@ -1,4 +1,3 @@
import type { FC } from "react";
import { useCallback, useEffect, useRef, useState } from "react"; import { useCallback, useEffect, useRef, useState } from "react";
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import { useTranslation } from "@plane/i18n"; import { useTranslation } from "@plane/i18n";

View file

@ -125,18 +125,16 @@ export class ProjectInboxStore implements IProjectInboxStore {
* @description computed project inbox filters * @description computed project inbox filters
*/ */
get inboxFilters() { get inboxFilters() {
const { projectId } = this.store.router; if (!this.currentInboxProjectId) return {} as TInboxIssueFilter;
if (!projectId) return {} as TInboxIssueFilter; return this.filtersMap?.[this.currentInboxProjectId];
return this.filtersMap?.[projectId];
} }
/** /**
* @description computed project inbox sorting * @description computed project inbox sorting
*/ */
get inboxSorting() { get inboxSorting() {
const { projectId } = this.store.router; if (!this.currentInboxProjectId) return {} as TInboxIssueSorting;
if (!projectId) return {} as TInboxIssueSorting; return this.sortingMap?.[this.currentInboxProjectId];
return this.sortingMap?.[projectId];
} }
get getAppliedFiltersCount() { get getAppliedFiltersCount() {
@ -274,7 +272,8 @@ export class ProjectInboxStore implements IProjectInboxStore {
}; };
handleInboxIssueFilters = <T extends keyof TInboxIssueFilter>(key: T, value: TInboxIssueFilter[T]) => { 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) { if (workspaceSlug && projectId) {
runInAction(() => { runInAction(() => {
set(this.filtersMap, [projectId, key], value); 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]) => { 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) { if (workspaceSlug && projectId) {
runInAction(() => { runInAction(() => {
set(this.sortingMap, [projectId, key], value); set(this.sortingMap, [projectId, key], value);