diff --git a/web/core/components/issues/issue-layouts/calendar/roots/project-view-root.tsx b/web/core/components/issues/issue-layouts/calendar/roots/project-view-root.tsx
index 9a26e8811..dc073fc9e 100644
--- a/web/core/components/issues/issue-layouts/calendar/roots/project-view-root.tsx
+++ b/web/core/components/issues/issue-layouts/calendar/roots/project-view-root.tsx
@@ -1,4 +1,5 @@
import { observer } from "mobx-react";
+import { useParams } from "next/navigation";
// hooks
import { ProjectIssueQuickActions } from "@/components/issues";
// components
@@ -6,6 +7,8 @@ import { ProjectIssueQuickActions } from "@/components/issues";
import { BaseCalendarRoot } from "../base-calendar-root";
// constants
-export const ProjectViewCalendarLayout: React.FC = observer(() => (
-
-));
+export const ProjectViewCalendarLayout: React.FC = observer(() => {
+ const { viewId } = useParams();
+
+ return ;
+});
diff --git a/web/core/components/issues/issue-layouts/kanban/kanban-group.tsx b/web/core/components/issues/issue-layouts/kanban/kanban-group.tsx
index 3fa00f0a3..f46b959c4 100644
--- a/web/core/components/issues/issue-layouts/kanban/kanban-group.tsx
+++ b/web/core/components/issues/issue-layouts/kanban/kanban-group.tsx
@@ -91,7 +91,7 @@ export const KanbanGroup = observer((props: IKanbanGroup) => {
loadMoreIssues(groupId, sub_group_id === "null"? undefined: sub_group_id)
}, [loadMoreIssues, groupId, sub_group_id])
- const isPaginating = !!getIssueLoader(groupId);
+ const isPaginating = !!getIssueLoader(groupId, sub_group_id);
useIntersectionObserver(
containerRef,
diff --git a/web/core/components/issues/issue-layouts/kanban/roots/project-view-root.tsx b/web/core/components/issues/issue-layouts/kanban/roots/project-view-root.tsx
index 585c68c28..051351444 100644
--- a/web/core/components/issues/issue-layouts/kanban/roots/project-view-root.tsx
+++ b/web/core/components/issues/issue-layouts/kanban/roots/project-view-root.tsx
@@ -1,5 +1,6 @@
import React from "react";
import { observer } from "mobx-react";
+import { useParams } from "next/navigation";
// hooks
// constant
// types
@@ -7,6 +8,8 @@ import { ProjectIssueQuickActions } from "../../quick-action-dropdowns";
// components
import { BaseKanBanRoot } from "../base-kanban-root";
-export const ProjectViewKanBanLayout: React.FC = observer(() => (
-
-));
+export const ProjectViewKanBanLayout: React.FC = observer(() => {
+ const { viewId } = useParams();
+
+ return ;
+});
diff --git a/web/core/components/issues/issue-layouts/list/roots/project-view-root.tsx b/web/core/components/issues/issue-layouts/list/roots/project-view-root.tsx
index 73e7fd6ab..9f7a07331 100644
--- a/web/core/components/issues/issue-layouts/list/roots/project-view-root.tsx
+++ b/web/core/components/issues/issue-layouts/list/roots/project-view-root.tsx
@@ -1,5 +1,6 @@
import React from "react";
import { observer } from "mobx-react";
+import { useParams } from "next/navigation";
// store
// constants
// types
@@ -7,4 +8,8 @@ import { ProjectIssueQuickActions } from "../../quick-action-dropdowns";
// components
import { BaseListRoot } from "../base-list-root";
-export const ProjectViewListLayout: React.FC = observer(() => );
+export const ProjectViewListLayout: React.FC = observer(() => {
+ const { viewId } = useParams();
+
+ return ;
+});
diff --git a/web/core/components/issues/issue-layouts/roots/project-view-layout-root.tsx b/web/core/components/issues/issue-layouts/roots/project-view-layout-root.tsx
index 11412632d..768d45781 100644
--- a/web/core/components/issues/issue-layouts/roots/project-view-layout-root.tsx
+++ b/web/core/components/issues/issue-layouts/roots/project-view-layout-root.tsx
@@ -19,7 +19,7 @@ import { useIssues } from "@/hooks/store";
import { IssuesStoreContext } from "@/hooks/use-issue-layout-store";
// types
-const ProjectViewIssueLayout = (props: { activeLayout: EIssueLayoutTypes | undefined }) => {
+const ProjectViewIssueLayout = (props: { activeLayout: EIssueLayoutTypes | undefined; viewId: string }) => {
switch (props.activeLayout) {
case EIssueLayoutTypes.LIST:
return ;
@@ -61,7 +61,7 @@ export const ProjectViewLayoutRoot: React.FC = observer(() => {
{/* peek overview */}
diff --git a/web/core/components/issues/issue-layouts/spreadsheet/roots/project-view-root.tsx b/web/core/components/issues/issue-layouts/spreadsheet/roots/project-view-root.tsx
index ce7cebfbb..78cf20bfb 100644
--- a/web/core/components/issues/issue-layouts/spreadsheet/roots/project-view-root.tsx
+++ b/web/core/components/issues/issue-layouts/spreadsheet/roots/project-view-root.tsx
@@ -1,5 +1,6 @@
import React from "react";
import { observer } from "mobx-react";
+import { useParams } from "next/navigation";
// mobx store
// components
import { ProjectIssueQuickActions } from "../../quick-action-dropdowns";
@@ -7,6 +8,8 @@ import { BaseSpreadsheetRoot } from "../base-spreadsheet-root";
// types
// constants
-export const ProjectViewSpreadsheetLayout: React.FC = observer(() => (
-
-));
+export const ProjectViewSpreadsheetLayout: React.FC = observer(() => {
+ const { viewId } = useParams();
+
+ return
;
+});
diff --git a/web/core/hooks/use-issues-actions.tsx b/web/core/hooks/use-issues-actions.tsx
index 2ea3df51e..482618697 100644
--- a/web/core/hooks/use-issues-actions.tsx
+++ b/web/core/hooks/use-issues-actions.tsx
@@ -459,16 +459,16 @@ const useProjectViewIssueActions = () => {
const { issues, issuesFilter } = useIssues(EIssuesStoreType.PROJECT_VIEW);
const fetchIssues = useCallback(
- async (loadType: TLoader, options: IssuePaginationOptions) => {
- if (!workspaceSlug || !projectId) return;
- return issues.fetchIssues(workspaceSlug.toString(), projectId.toString(), loadType, options);
+ async (loadType: TLoader, options: IssuePaginationOptions, viewId?: string) => {
+ if (!workspaceSlug || !projectId || !viewId) return;
+ return issues.fetchIssues(workspaceSlug.toString(), projectId.toString(), viewId, loadType, options);
},
[issues.fetchIssues, workspaceSlug, projectId]
);
const fetchNextIssues = useCallback(
async (groupId?: string, subGroupId?: string) => {
- if (!workspaceSlug || !projectId) return;
- return issues.fetchNextIssues(workspaceSlug.toString(), projectId.toString(), groupId, subGroupId);
+ if (!workspaceSlug || !projectId || !viewId) return;
+ return issues.fetchNextIssues(workspaceSlug.toString(), projectId.toString(), viewId, groupId, subGroupId);
},
[issues.fetchIssues, workspaceSlug, projectId]
);
diff --git a/web/core/store/issue/archived/filter.store.ts b/web/core/store/issue/archived/filter.store.ts
index f48cf735c..3f0a4fedc 100644
--- a/web/core/store/issue/archived/filter.store.ts
+++ b/web/core/store/issue/archived/filter.store.ts
@@ -28,6 +28,7 @@ export interface IArchivedIssuesFilter extends IBaseIssueFilterStore {
//helper actions
getFilterParams: (
options: IssuePaginationOptions,
+ projectId: string,
cursor: string | undefined,
groupId: string | undefined,
subGroupId: string | undefined
@@ -72,6 +73,17 @@ export class ArchivedIssuesFilter extends IssueFilterHelperStore implements IArc
const projectId = this.rootIssueStore.projectId;
if (!projectId) return undefined;
+ return this.getIssueFilters(projectId);
+ }
+
+ get appliedFilters() {
+ const projectId = this.rootIssueStore.projectId;
+ if (!projectId) return undefined;
+
+ return this.getAppliedFilters(projectId);
+ }
+
+ getIssueFilters(projectId: string) {
const displayFilters = this.filters[projectId] || undefined;
if (isEmpty(displayFilters)) return undefined;
@@ -80,8 +92,8 @@ export class ArchivedIssuesFilter extends IssueFilterHelperStore implements IArc
return _filters;
}
- get appliedFilters() {
- const userFilters = this.issueFilters;
+ getAppliedFilters(projectId: string) {
+ const userFilters = this.getIssueFilters(projectId);
if (!userFilters) return undefined;
const filteredParams = handleIssueQueryParamsByLayout(userFilters?.displayFilters?.layout, "issues");
@@ -99,11 +111,12 @@ export class ArchivedIssuesFilter extends IssueFilterHelperStore implements IArc
getFilterParams = computedFn(
(
options: IssuePaginationOptions,
+ projectId: string,
cursor: string | undefined,
groupId: string | undefined,
subGroupId: string | undefined
) => {
- const filterParams = this.appliedFilters;
+ const filterParams = this.getAppliedFilters(projectId);
const paginationParams = this.getPaginationParams(filterParams, options, cursor, groupId, subGroupId);
return paginationParams;
@@ -211,7 +224,9 @@ export class ArchivedIssuesFilter extends IssueFilterHelperStore implements IArc
});
});
- this.rootIssueStore.archivedIssues.fetchIssuesWithExistingPagination(workspaceSlug, projectId, "mutation");
+ if (this.getShouldReFetchIssues(updatedDisplayFilters)) {
+ this.rootIssueStore.archivedIssues.fetchIssuesWithExistingPagination(workspaceSlug, projectId, "mutation");
+ }
this.handleIssuesLocalFilters.set(EIssuesStoreType.ARCHIVED, type, workspaceSlug, projectId, undefined, {
display_filters: _filters.displayFilters,
diff --git a/web/core/store/issue/archived/issue.store.ts b/web/core/store/issue/archived/issue.store.ts
index e4322d665..1d3b691fb 100644
--- a/web/core/store/issue/archived/issue.store.ts
+++ b/web/core/store/issue/archived/issue.store.ts
@@ -94,7 +94,7 @@ export class ArchivedIssues extends BaseIssuesStore implements IArchivedIssues {
this.clear(!isExistingPaginationOptions);
// get params from pagination options
- const params = this.issueFilterStore?.getFilterParams(options, undefined, undefined, undefined);
+ const params = this.issueFilterStore?.getFilterParams(options, projectId, undefined, undefined, undefined);
// call the fetch issues API with the params
const response = await this.issueArchiveService.getArchivedIssues(workspaceSlug, projectId, params, {
signal: this.controller.signal,
@@ -131,6 +131,7 @@ export class ArchivedIssues extends BaseIssuesStore implements IArchivedIssues {
// get params from stored pagination options
const params = this.issueFilterStore?.getFilterParams(
this.paginationOptions,
+ projectId,
this.getNextCursor(groupId, subGroupId),
groupId,
subGroupId
diff --git a/web/core/store/issue/cycle/filter.store.ts b/web/core/store/issue/cycle/filter.store.ts
index bacc25652..490393a43 100644
--- a/web/core/store/issue/cycle/filter.store.ts
+++ b/web/core/store/issue/cycle/filter.store.ts
@@ -28,6 +28,7 @@ export interface ICycleIssuesFilter extends IBaseIssueFilterStore {
//helper actions
getFilterParams: (
options: IssuePaginationOptions,
+ cycleId: string,
cursor: string | undefined,
groupId: string | undefined,
subGroupId: string | undefined
@@ -73,6 +74,17 @@ export class CycleIssuesFilter extends IssueFilterHelperStore implements ICycleI
const cycleId = this.rootIssueStore.cycleId;
if (!cycleId) return undefined;
+ return this.getIssueFilters(cycleId);
+ }
+
+ get appliedFilters() {
+ const cycleId = this.rootIssueStore.cycleId;
+ if (!cycleId) return undefined;
+
+ return this.getAppliedFilters(cycleId);
+ }
+
+ getIssueFilters(cycleId: string) {
const displayFilters = this.filters[cycleId] || undefined;
if (isEmpty(displayFilters)) return undefined;
@@ -81,8 +93,8 @@ export class CycleIssuesFilter extends IssueFilterHelperStore implements ICycleI
return _filters;
}
- get appliedFilters() {
- const userFilters = this.issueFilters;
+ getAppliedFilters(cycleId: string) {
+ const userFilters = this.getIssueFilters(cycleId);
if (!userFilters) return undefined;
const filteredParams = handleIssueQueryParamsByLayout(userFilters?.displayFilters?.layout, "issues");
@@ -102,11 +114,12 @@ export class CycleIssuesFilter extends IssueFilterHelperStore implements ICycleI
getFilterParams = computedFn(
(
options: IssuePaginationOptions,
+ cycleId: string,
cursor: string | undefined,
groupId: string | undefined,
subGroupId: string | undefined
) => {
- const filterParams = this.appliedFilters;
+ const filterParams = this.getAppliedFilters(cycleId);
const paginationParams = this.getPaginationParams(filterParams, options, cursor, groupId, subGroupId);
return paginationParams;
@@ -223,12 +236,14 @@ export class CycleIssuesFilter extends IssueFilterHelperStore implements ICycleI
});
});
- this.rootIssueStore.cycleIssues.fetchIssuesWithExistingPagination(
- workspaceSlug,
- projectId,
- "mutation",
- cycleId
- );
+ if (this.getShouldReFetchIssues(updatedDisplayFilters)) {
+ this.rootIssueStore.cycleIssues.fetchIssuesWithExistingPagination(
+ workspaceSlug,
+ projectId,
+ "mutation",
+ cycleId
+ );
+ }
await this.issueFilterService.patchCycleIssueFilters(workspaceSlug, projectId, cycleId, {
display_filters: _filters.displayFilters,
diff --git a/web/core/store/issue/cycle/issue.store.ts b/web/core/store/issue/cycle/issue.store.ts
index 61d2cfe44..a71337ea6 100644
--- a/web/core/store/issue/cycle/issue.store.ts
+++ b/web/core/store/issue/cycle/issue.store.ts
@@ -161,7 +161,7 @@ export class CycleIssues extends BaseIssuesStore implements ICycleIssues {
this.clear(!isExistingPaginationOptions);
// get params from pagination options
- const params = this.issueFilterStore?.getFilterParams(options, undefined, undefined, undefined);
+ const params = this.issueFilterStore?.getFilterParams(options, cycleId, undefined, undefined, undefined);
// call the fetch issues API with the params
const response = await this.cycleService.getCycleIssues(workspaceSlug, projectId, cycleId, params, {
signal: this.controller.signal,
@@ -205,6 +205,7 @@ export class CycleIssues extends BaseIssuesStore implements ICycleIssues {
// get params from stored pagination options
const params = this.issueFilterStore?.getFilterParams(
this.paginationOptions,
+ cycleId,
this.getNextCursor(groupId, subGroupId),
groupId,
subGroupId
diff --git a/web/core/store/issue/draft/filter.store.ts b/web/core/store/issue/draft/filter.store.ts
index ea503632d..caec39b93 100644
--- a/web/core/store/issue/draft/filter.store.ts
+++ b/web/core/store/issue/draft/filter.store.ts
@@ -28,6 +28,7 @@ export interface IDraftIssuesFilter extends IBaseIssueFilterStore {
//helper actions
getFilterParams: (
options: IssuePaginationOptions,
+ projectId: string,
cursor: string | undefined,
groupId: string | undefined,
subGroupId: string | undefined
@@ -72,6 +73,17 @@ export class DraftIssuesFilter extends IssueFilterHelperStore implements IDraftI
const projectId = this.rootIssueStore.projectId;
if (!projectId) return undefined;
+ return this.getIssueFilters(projectId);
+ }
+
+ get appliedFilters() {
+ const projectId = this.rootIssueStore.projectId;
+ if (!projectId) return undefined;
+
+ return this.getAppliedFilters(projectId);
+ }
+
+ getIssueFilters(projectId: string) {
const displayFilters = this.filters[projectId] || undefined;
if (!projectId || isEmpty(displayFilters)) return undefined;
@@ -80,8 +92,8 @@ export class DraftIssuesFilter extends IssueFilterHelperStore implements IDraftI
return _filters;
}
- get appliedFilters() {
- const userFilters = this.issueFilters;
+ getAppliedFilters(projectId: string) {
+ const userFilters = this.getIssueFilters(projectId);
if (!userFilters) return undefined;
const filteredParams = handleIssueQueryParamsByLayout(userFilters?.displayFilters?.layout, "issues");
@@ -99,11 +111,12 @@ export class DraftIssuesFilter extends IssueFilterHelperStore implements IDraftI
getFilterParams = computedFn(
(
options: IssuePaginationOptions,
+ projectId: string,
cursor: string | undefined,
groupId: string | undefined,
subGroupId: string | undefined
) => {
- const filterParams = this.appliedFilters;
+ const filterParams = this.getAppliedFilters(projectId);
const paginationParams = this.getPaginationParams(filterParams, options, cursor, groupId, subGroupId);
return paginationParams;
@@ -206,7 +219,9 @@ export class DraftIssuesFilter extends IssueFilterHelperStore implements IDraftI
});
});
- this.rootIssueStore.draftIssues.fetchIssuesWithExistingPagination(workspaceSlug, projectId, "mutation");
+ if (this.getShouldReFetchIssues(updatedDisplayFilters)) {
+ this.rootIssueStore.draftIssues.fetchIssuesWithExistingPagination(workspaceSlug, projectId, "mutation");
+ }
this.handleIssuesLocalFilters.set(EIssuesStoreType.DRAFT, type, workspaceSlug, projectId, undefined, {
display_filters: _filters.displayFilters,
diff --git a/web/core/store/issue/draft/issue.store.ts b/web/core/store/issue/draft/issue.store.ts
index 5d4a6e88f..b5a85e786 100644
--- a/web/core/store/issue/draft/issue.store.ts
+++ b/web/core/store/issue/draft/issue.store.ts
@@ -92,7 +92,7 @@ export class DraftIssues extends BaseIssuesStore implements IDraftIssues {
this.clear(!isExistingPaginationOptions);
// get params from pagination options
- const params = this.issueFilterStore?.getFilterParams(options, undefined, undefined, undefined);
+ const params = this.issueFilterStore?.getFilterParams(options, projectId, undefined, undefined, undefined);
// call the fetch issues API with the params
const response = await this.issueDraftService.getDraftIssues(workspaceSlug, projectId, params, {
signal: this.controller.signal,
@@ -129,6 +129,7 @@ export class DraftIssues extends BaseIssuesStore implements IDraftIssues {
// get params from stored pagination options
const params = this.issueFilterStore?.getFilterParams(
this.paginationOptions,
+ projectId,
this.getNextCursor(groupId, subGroupId),
groupId,
subGroupId
diff --git a/web/core/store/issue/helpers/issue-filter-helper.store.ts b/web/core/store/issue/helpers/issue-filter-helper.store.ts
index 41d014d39..42eccc6a6 100644
--- a/web/core/store/issue/helpers/issue-filter-helper.store.ts
+++ b/web/core/store/issue/helpers/issue-filter-helper.store.ts
@@ -290,7 +290,7 @@ export class IssueFilterHelperStore implements IIssueFilterHelperStore {
* @param displayFilters
* @returns
*/
- requiresServerUpdate = (displayFilters: IIssueDisplayFilterOptions) => {
+ getShouldReFetchIssues = (displayFilters: IIssueDisplayFilterOptions) => {
const NON_SERVER_DISPLAY_FILTERS = ["order_by", "sub_issue", "type"];
const displayFilterKeys = Object.keys(displayFilters);
diff --git a/web/core/store/issue/module/filter.store.ts b/web/core/store/issue/module/filter.store.ts
index 16aee2457..1e02ba13a 100644
--- a/web/core/store/issue/module/filter.store.ts
+++ b/web/core/store/issue/module/filter.store.ts
@@ -28,6 +28,7 @@ export interface IModuleIssuesFilter extends IBaseIssueFilterStore {
//helper actions
getFilterParams: (
options: IssuePaginationOptions,
+ moduleId: string,
cursor: string | undefined,
groupId: string | undefined,
subGroupId: string | undefined
@@ -73,6 +74,17 @@ export class ModuleIssuesFilter extends IssueFilterHelperStore implements IModul
const moduleId = this.rootIssueStore.moduleId;
if (!moduleId) return undefined;
+ return this.getIssueFilters(moduleId);
+ }
+
+ get appliedFilters() {
+ const moduleId = this.rootIssueStore.moduleId;
+ if (!moduleId) return undefined;
+
+ return this.getAppliedFilters(moduleId);
+ }
+
+ getIssueFilters(moduleId: string) {
const displayFilters = this.filters[moduleId] || undefined;
if (isEmpty(displayFilters)) return undefined;
@@ -81,8 +93,8 @@ export class ModuleIssuesFilter extends IssueFilterHelperStore implements IModul
return _filters;
}
- get appliedFilters() {
- const userFilters = this.issueFilters;
+ getAppliedFilters(moduleId: string) {
+ const userFilters = this.getIssueFilters(moduleId);
if (!userFilters) return undefined;
const filteredParams = handleIssueQueryParamsByLayout(userFilters?.displayFilters?.layout, "issues");
@@ -102,11 +114,12 @@ export class ModuleIssuesFilter extends IssueFilterHelperStore implements IModul
getFilterParams = computedFn(
(
options: IssuePaginationOptions,
+ moduleId: string,
cursor: string | undefined,
groupId: string | undefined,
subGroupId: string | undefined
) => {
- const filterParams = this.appliedFilters;
+ const filterParams = this.getAppliedFilters(moduleId);
const paginationParams = this.getPaginationParams(filterParams, options, cursor, groupId, subGroupId);
return paginationParams;
@@ -222,12 +235,14 @@ export class ModuleIssuesFilter extends IssueFilterHelperStore implements IModul
});
});
- this.rootIssueStore.moduleIssues.fetchIssuesWithExistingPagination(
- workspaceSlug,
- projectId,
- "mutation",
- moduleId
- );
+ if (this.getShouldReFetchIssues(updatedDisplayFilters)) {
+ this.rootIssueStore.moduleIssues.fetchIssuesWithExistingPagination(
+ workspaceSlug,
+ projectId,
+ "mutation",
+ moduleId
+ );
+ }
await this.issueFilterService.patchModuleIssueFilters(workspaceSlug, projectId, moduleId, {
display_filters: _filters.displayFilters,
diff --git a/web/core/store/issue/module/issue.store.ts b/web/core/store/issue/module/issue.store.ts
index b042e3c49..4f89f0366 100644
--- a/web/core/store/issue/module/issue.store.ts
+++ b/web/core/store/issue/module/issue.store.ts
@@ -116,7 +116,7 @@ export class ModuleIssues extends BaseIssuesStore implements IModuleIssues {
this.clear(!isExistingPaginationOptions);
// get params from pagination options
- const params = this.issueFilterStore?.getFilterParams(options, undefined, undefined, undefined);
+ const params = this.issueFilterStore?.getFilterParams(options, moduleId, undefined, undefined, undefined);
// call the fetch issues API with the params
const response = await this.moduleService.getModuleIssues(workspaceSlug, projectId, moduleId, params, {
signal: this.controller.signal,
@@ -160,6 +160,7 @@ export class ModuleIssues extends BaseIssuesStore implements IModuleIssues {
// get params from stored pagination options
const params = this.issueFilterStore?.getFilterParams(
this.paginationOptions,
+ moduleId,
this.getNextCursor(groupId, subGroupId),
groupId,
subGroupId
diff --git a/web/core/store/issue/profile/filter.store.ts b/web/core/store/issue/profile/filter.store.ts
index f13c3d297..8e27a1081 100644
--- a/web/core/store/issue/profile/filter.store.ts
+++ b/web/core/store/issue/profile/filter.store.ts
@@ -30,6 +30,7 @@ export interface IProfileIssuesFilter extends IBaseIssueFilterStore {
//helper actions
getFilterParams: (
options: IssuePaginationOptions,
+ userId: string,
cursor: string | undefined,
groupId: string | undefined,
subGroupId: string | undefined
@@ -77,6 +78,17 @@ export class ProfileIssuesFilter extends IssueFilterHelperStore implements IProf
const userId = this.rootIssueStore.userId;
if (!userId) return undefined;
+ return this.getIssueFilters(userId);
+ }
+
+ get appliedFilters() {
+ const userId = this.rootIssueStore.userId;
+ if (!userId) return undefined;
+
+ return this.getAppliedFilters(userId);
+ }
+
+ getIssueFilters(userId: string) {
const displayFilters = this.filters[userId] || undefined;
if (isEmpty(displayFilters)) return undefined;
@@ -85,8 +97,8 @@ export class ProfileIssuesFilter extends IssueFilterHelperStore implements IProf
return _filters;
}
- get appliedFilters() {
- const userFilters = this.issueFilters;
+ getAppliedFilters(userId: string) {
+ const userFilters = this.getIssueFilters(userId);
if (!userFilters) return undefined;
const filteredParams = handleIssueQueryParamsByLayout(userFilters?.displayFilters?.layout, "profile_issues");
@@ -104,11 +116,12 @@ export class ProfileIssuesFilter extends IssueFilterHelperStore implements IProf
getFilterParams = computedFn(
(
options: IssuePaginationOptions,
+ userId: string,
cursor: string | undefined,
groupId: string | undefined,
subGroupId: string | undefined
) => {
- const filterParams = this.appliedFilters;
+ const filterParams = this.getAppliedFilters(userId);
const paginationParams = this.getPaginationParams(filterParams, options, cursor, groupId, subGroupId);
return paginationParams;
diff --git a/web/core/store/issue/profile/issue.store.ts b/web/core/store/issue/profile/issue.store.ts
index 3bfd3dc0e..a41d33088 100644
--- a/web/core/store/issue/profile/issue.store.ts
+++ b/web/core/store/issue/profile/issue.store.ts
@@ -119,7 +119,7 @@ export class ProfileIssues extends BaseIssuesStore implements IProfileIssues {
this.setViewId(view);
// get params from pagination options
- let params = this.issueFilterStore?.getFilterParams(options, undefined, undefined, undefined);
+ let params = this.issueFilterStore?.getFilterParams(options, userId, undefined, undefined, undefined);
params = {
...params,
assignees: undefined,
@@ -167,6 +167,7 @@ export class ProfileIssues extends BaseIssuesStore implements IProfileIssues {
// get params from stored pagination options
let params = this.issueFilterStore?.getFilterParams(
this.paginationOptions,
+ userId,
this.getNextCursor(groupId, subGroupId),
groupId,
subGroupId
diff --git a/web/core/store/issue/project-views/filter.store.ts b/web/core/store/issue/project-views/filter.store.ts
index d8d95b7d6..40169e89c 100644
--- a/web/core/store/issue/project-views/filter.store.ts
+++ b/web/core/store/issue/project-views/filter.store.ts
@@ -28,6 +28,7 @@ export interface IProjectViewIssuesFilter extends IBaseIssueFilterStore {
//helper actions
getFilterParams: (
options: IssuePaginationOptions,
+ viewId: string,
cursor: string | undefined,
groupId: string | undefined,
subGroupId: string | undefined
@@ -73,6 +74,17 @@ export class ProjectViewIssuesFilter extends IssueFilterHelperStore implements I
const viewId = this.rootIssueStore.viewId;
if (!viewId) return undefined;
+ return this.getIssueFilters(viewId);
+ }
+
+ get appliedFilters() {
+ const viewId = this.rootIssueStore.viewId;
+ if (!viewId) return undefined;
+
+ return this.getAppliedFilters(viewId);
+ }
+
+ getIssueFilters(viewId: string) {
const displayFilters = this.filters[viewId] || undefined;
if (isEmpty(displayFilters)) return undefined;
@@ -81,8 +93,8 @@ export class ProjectViewIssuesFilter extends IssueFilterHelperStore implements I
return _filters;
}
- get appliedFilters() {
- const userFilters = this.issueFilters;
+ getAppliedFilters(viewId: string) {
+ const userFilters = this.getIssueFilters(viewId);
if (!userFilters) return undefined;
const filteredParams = handleIssueQueryParamsByLayout(userFilters?.displayFilters?.layout, "issues");
@@ -100,11 +112,12 @@ export class ProjectViewIssuesFilter extends IssueFilterHelperStore implements I
getFilterParams = computedFn(
(
options: IssuePaginationOptions,
+ viewId: string,
cursor: string | undefined,
groupId: string | undefined,
subGroupId: string | undefined
) => {
- const filterParams = this.appliedFilters;
+ const filterParams = this.getAppliedFilters(viewId);
const paginationParams = this.getPaginationParams(filterParams, options, cursor, groupId, subGroupId);
return paginationParams;
@@ -180,6 +193,7 @@ export class ProjectViewIssuesFilter extends IssueFilterHelperStore implements I
this.rootIssueStore.projectViewIssues.fetchIssuesWithExistingPagination(
workspaceSlug,
projectId,
+ viewId,
isEmpty(filteredFilters) ? "init-loader" : "mutation"
);
break;
@@ -217,7 +231,14 @@ export class ProjectViewIssuesFilter extends IssueFilterHelperStore implements I
});
});
- this.rootIssueStore.projectViewIssues.fetchIssuesWithExistingPagination(workspaceSlug, projectId, "mutation");
+ if (this.getShouldReFetchIssues(updatedDisplayFilters)) {
+ this.rootIssueStore.projectViewIssues.fetchIssuesWithExistingPagination(
+ workspaceSlug,
+ projectId,
+ viewId,
+ "mutation"
+ );
+ }
await this.issueFilterService.patchView(workspaceSlug, projectId, viewId, {
display_filters: _filters.displayFilters,
diff --git a/web/core/store/issue/project-views/issue.store.ts b/web/core/store/issue/project-views/issue.store.ts
index 1d2d7f0c9..2088d30c1 100644
--- a/web/core/store/issue/project-views/issue.store.ts
+++ b/web/core/store/issue/project-views/issue.store.ts
@@ -20,17 +20,20 @@ export interface IProjectViewIssues extends IBaseIssuesStore {
fetchIssues: (
workspaceSlug: string,
projectId: string,
+ viewId: string,
loadType: TLoader,
options: IssuePaginationOptions
) => Promise
;
fetchIssuesWithExistingPagination: (
workspaceSlug: string,
projectId: string,
+ viewId: string,
loadType: TLoader
) => Promise;
fetchNextIssues: (
workspaceSlug: string,
projectId: string,
+ viewId: string,
groupId?: string,
subGroupId?: string
) => Promise;
@@ -78,6 +81,7 @@ export class ProjectViewIssues extends BaseIssuesStore implements IProjectViewIs
fetchIssues = async (
workspaceSlug: string,
projectId: string,
+ viewId: string,
loadType: TLoader,
options: IssuePaginationOptions,
isExistingPaginationOptions: boolean = false
@@ -90,7 +94,7 @@ export class ProjectViewIssues extends BaseIssuesStore implements IProjectViewIs
this.clear(!isExistingPaginationOptions);
// get params from pagination options
- const params = this.issueFilterStore?.getFilterParams(options, undefined, undefined, undefined);
+ const params = this.issueFilterStore?.getFilterParams(options, viewId, undefined, undefined, undefined);
// call the fetch issues API with the params
const response = await this.issueService.getIssues(workspaceSlug, projectId, params, {
signal: this.controller.signal,
@@ -116,7 +120,13 @@ export class ProjectViewIssues extends BaseIssuesStore implements IProjectViewIs
* @param subGroupId
* @returns
*/
- fetchNextIssues = async (workspaceSlug: string, projectId: string, groupId?: string, subGroupId?: string) => {
+ fetchNextIssues = async (
+ workspaceSlug: string,
+ projectId: string,
+ viewId: string,
+ groupId?: string,
+ subGroupId?: string
+ ) => {
const cursorObject = this.getPaginationData(groupId, subGroupId);
// if there are no pagination options and the next page results do not exist the return
if (!this.paginationOptions || (cursorObject && !cursorObject?.nextPageResults)) return;
@@ -127,6 +137,7 @@ export class ProjectViewIssues extends BaseIssuesStore implements IProjectViewIs
// get params from stored pagination options
const params = this.issueFilterStore?.getFilterParams(
this.paginationOptions,
+ viewId,
this.getNextCursor(groupId, subGroupId),
groupId,
subGroupId
@@ -152,9 +163,14 @@ export class ProjectViewIssues extends BaseIssuesStore implements IProjectViewIs
* @param loadType
* @returns
*/
- fetchIssuesWithExistingPagination = async (workspaceSlug: string, projectId: string, loadType: TLoader) => {
+ fetchIssuesWithExistingPagination = async (
+ workspaceSlug: string,
+ projectId: string,
+ viewId: string,
+ loadType: TLoader
+ ) => {
if (!this.paginationOptions) return;
- return await this.fetchIssues(workspaceSlug, projectId, loadType, this.paginationOptions, true);
+ return await this.fetchIssues(workspaceSlug, projectId, viewId, loadType, this.paginationOptions, true);
};
archiveBulkIssues = this.bulkArchiveIssues;
diff --git a/web/core/store/issue/project/filter.store.ts b/web/core/store/issue/project/filter.store.ts
index 6ea79fe1b..a8e611016 100644
--- a/web/core/store/issue/project/filter.store.ts
+++ b/web/core/store/issue/project/filter.store.ts
@@ -28,6 +28,7 @@ export interface IProjectIssuesFilter extends IBaseIssueFilterStore {
//helper actions
getFilterParams: (
options: IssuePaginationOptions,
+ projectId: string,
cursor: string | undefined,
groupId: string | undefined,
subGroupId: string | undefined
@@ -70,18 +71,27 @@ export class ProjectIssuesFilter extends IssueFilterHelperStore implements IProj
get issueFilters() {
const projectId = this.rootIssueStore.projectId;
- console.log("projectId", projectId);
if (!projectId) return undefined;
+ return this.getIssueFilters(projectId);
+ }
+
+ get appliedFilters() {
+ const projectId = this.rootIssueStore.projectId;
+ if (!projectId) return undefined;
+
+ return this.getAppliedFilters(projectId);
+ }
+
+ getIssueFilters(projectId: string) {
const displayFilters = this.filters[projectId] || undefined;
- console.log("displayFilters", displayFilters);
if (isEmpty(displayFilters)) return undefined;
return this.computedIssueFilters(displayFilters);
}
- get appliedFilters() {
- const userFilters = this.issueFilters;
+ getAppliedFilters(projectId: string) {
+ const userFilters = this.getIssueFilters(projectId);
if (!userFilters) return undefined;
const filteredParams = handleIssueQueryParamsByLayout(userFilters?.displayFilters?.layout, "issues");
@@ -99,11 +109,12 @@ export class ProjectIssuesFilter extends IssueFilterHelperStore implements IProj
getFilterParams = computedFn(
(
options: IssuePaginationOptions,
+ projectId: string,
cursor: string | undefined,
groupId: string | undefined,
subGroupId: string | undefined
) => {
- const filterParams = this.appliedFilters;
+ const filterParams = this.getAppliedFilters(projectId);
const paginationParams = this.getPaginationParams(filterParams, options, cursor, groupId, subGroupId);
return paginationParams;
}
@@ -217,8 +228,9 @@ export class ProjectIssuesFilter extends IssueFilterHelperStore implements IProj
});
});
- if (this.requiresServerUpdate(updatedDisplayFilters))
+ if (this.getShouldReFetchIssues(updatedDisplayFilters)) {
this.rootIssueStore.projectIssues.fetchIssuesWithExistingPagination(workspaceSlug, projectId, "mutation");
+ }
await this.issueFilterService.patchProjectIssueFilters(workspaceSlug, projectId, {
display_filters: _filters.displayFilters,
diff --git a/web/core/store/issue/project/issue.store.ts b/web/core/store/issue/project/issue.store.ts
index 27a696253..413081716 100644
--- a/web/core/store/issue/project/issue.store.ts
+++ b/web/core/store/issue/project/issue.store.ts
@@ -93,7 +93,7 @@ export class ProjectIssues extends BaseIssuesStore implements IProjectIssues {
this.clear(!isExistingPaginationOptions);
// get params from pagination options
- const params = this.issueFilterStore?.getFilterParams(options, undefined, undefined, undefined);
+ const params = this.issueFilterStore?.getFilterParams(options, projectId, undefined, undefined, undefined);
// call the fetch issues API with the params
const response = await this.issueService.getIssues(workspaceSlug, projectId, params, {
signal: this.controller.signal,
@@ -130,6 +130,7 @@ export class ProjectIssues extends BaseIssuesStore implements IProjectIssues {
// get params from stored pagination options
const params = this.issueFilterStore?.getFilterParams(
this.paginationOptions,
+ projectId,
this.getNextCursor(groupId, subGroupId),
groupId,
subGroupId
diff --git a/web/core/store/issue/workspace/filter.store.ts b/web/core/store/issue/workspace/filter.store.ts
index 1e05f5564..9fc48a424 100644
--- a/web/core/store/issue/workspace/filter.store.ts
+++ b/web/core/store/issue/workspace/filter.store.ts
@@ -41,8 +41,8 @@ export interface IWorkspaceIssuesFilter extends IBaseIssueFilterStore {
getIssueFilters: (viewId: string | undefined) => IIssueFilters | undefined;
getAppliedFilters: (viewId: string) => Partial> | undefined;
getFilterParams: (
- viewId: string,
options: IssuePaginationOptions,
+ viewId: string,
cursor: string | undefined,
groupId: string | undefined,
subGroupId: string | undefined
@@ -104,10 +104,20 @@ export class WorkspaceIssuesFilter extends IssueFilterHelperStore implements IWo
return filteredRouteParams;
};
+ get issueFilters() {
+ const viewId = this.rootIssueStore.globalViewId;
+ return this.getIssueFilters(viewId);
+ }
+
+ get appliedFilters() {
+ const viewId = this.rootIssueStore.globalViewId;
+ return this.getAppliedFilters(viewId);
+ }
+
getFilterParams = computedFn(
(
- viewId: string,
options: IssuePaginationOptions,
+ viewId: string,
cursor: string | undefined,
groupId: string | undefined,
subGroupId: string | undefined
@@ -119,16 +129,6 @@ export class WorkspaceIssuesFilter extends IssueFilterHelperStore implements IWo
}
);
- get issueFilters() {
- const viewId = this.rootIssueStore.globalViewId;
- return this.getIssueFilters(viewId);
- }
-
- get appliedFilters() {
- const viewId = this.rootIssueStore.globalViewId;
- return this.getAppliedFilters(viewId);
- }
-
fetchFilters = async (workspaceSlug: string, viewId: TWorkspaceFilters) => {
try {
let filters: IIssueFilterOptions;
diff --git a/web/core/store/issue/workspace/issue.store.ts b/web/core/store/issue/workspace/issue.store.ts
index 24415a9b7..a3bf7a6cc 100644
--- a/web/core/store/issue/workspace/issue.store.ts
+++ b/web/core/store/issue/workspace/issue.store.ts
@@ -92,7 +92,7 @@ export class WorkspaceIssues extends BaseIssuesStore implements IWorkspaceIssues
this.clear(!isExistingPaginationOptions);
// get params from pagination options
- const params = this.issueFilterStore?.getFilterParams(viewId, options, undefined, undefined, undefined);
+ const params = this.issueFilterStore?.getFilterParams(options, viewId, undefined, undefined, undefined);
// call the fetch issues API with the params
const response = await this.workspaceService.getViewIssues(workspaceSlug, params, {
signal: this.controller.signal,
@@ -128,8 +128,8 @@ export class WorkspaceIssues extends BaseIssuesStore implements IWorkspaceIssues
// get params from stored pagination options
const params = this.issueFilterStore?.getFilterParams(
- viewId,
this.paginationOptions,
+ viewId,
this.getNextCursor(groupId, subGroupId),
groupId,
subGroupId