π₯π₯π₯ 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
chore: issue filter loader improvement (#3406)
Anmol Singh Bhatia864519e770cf
diff --git a/web/store/issue/archived/filter.store.ts b/web/store/issue/archived/filter.store.tsindex 7192cc0124..fe4d686427 100644--- a/web/store/issue/archived/filter.store.ts+++ b/web/store/issue/archived/filter.store.ts@@ -1,6 +1,8 @@import { action, computed, makeObservable, observable, runInAction } from "mobx";import isEmpty from "lodash/isEmpty";import set from "lodash/set";+import pickBy from "lodash/pickBy";+import isArray from "lodash/isArray";// base classimport { IssueFilterHelperStore } from "../helpers/issue-filter-helper.store";// helpers@@ -148,8 +150,13 @@ export class ArchivedIssuesFilter extends IssueFilterHelperStore implements IArcset(this.filters, [projectId, "filters", _key], updatedFilters[_key as keyof IIssueFilterOptions]);});});-- this.rootIssueStore.archivedIssues.fetchIssues(workspaceSlug, projectId, "mutation");+ const appliedFilters = _filters.filters || {};+ const filteredFilters = pickBy(appliedFilters, (value) => value && isArray(value) && value.length > 0);+ this.rootIssueStore.archivedIssues.fetchIssues(+ workspaceSlug,+ projectId,+ isEmpty(filteredFilters) ? "init-loader" : "mutation"+ );this.handleIssuesLocalFilters.set(EIssuesStoreType.ARCHIVED, type, workspaceSlug, projectId, undefined, {filters: _filters.filters,});diff --git a/web/store/issue/cycle/filter.store.ts b/web/store/issue/cycle/filter.store.tsindex 4c640977a8..e6ea3dde1a 100644--- a/web/store/issue/cycle/filter.store.ts+++ b/web/store/issue/cycle/filter.store.ts@@ -1,6 +1,8 @@import { action, computed, makeObservable, observable, runInAction } from "mobx";import isEmpty from "lodash/isEmpty";import set from "lodash/set";+import pickBy from "lodash/pickBy";+import isArray from "lodash/isArray";// base classimport { IssueFilterHelperStore } from "../helpers/issue-filter-helper.store";// helpers@@ -158,7 +160,14 @@ export class CycleIssuesFilter extends IssueFilterHelperStore implements ICycleI});});- this.rootIssueStore.cycleIssues.fetchIssues(workspaceSlug, projectId, "mutation", cycleId);+ const appliedFilters = _filters.filters || {};+ const filteredFilters = pickBy(appliedFilters, (value) => value && isArray(value) && value.length > 0);+ this.rootIssueStore.cycleIssues.fetchIssues(+ workspaceSlug,+ projectId,+ isEmpty(filteredFilters) ? "init-loader" : "mutation",+ cycleId+ );await this.issueFilterService.patchCycleIssueFilters(workspaceSlug, projectId, cycleId, {filters: _filters.filters,});diff --git a/web/store/issue/draft/filter.store.ts b/web/store/issue/draft/filter.store.tsindex a303ee90e7..658a2dd244 100644--- a/web/store/issue/draft/filter.store.ts+++ b/web/store/issue/draft/filter.store.ts@@ -1,6 +1,8 @@import { action, computed, makeObservable, observable, runInAction } from "mobx";import isEmpty from "lodash/isEmpty";import set from "lodash/set";+import pickBy from "lodash/pickBy";+import isArray from "lodash/isArray";// base classimport { IssueFilterHelperStore } from "../helpers/issue-filter-helper.store";// helpers@@ -143,8 +145,13 @@ export class DraftIssuesFilter extends IssueFilterHelperStore implements IDraftIset(this.filters, [projectId, "filters", _key], updatedFilters[_key as keyof IIssueFilterOptions]);});});-- this.rootIssueStore.draftIssues.fetchIssues(workspaceSlug, projectId, "mutation");+ const appliedFilters = _filters.filters || {};+ const filteredFilters = pickBy(appliedFilters, (value) => value && isArray(value) && value.length > 0);+ this.rootIssueStore.draftIssues.fetchIssues(+ workspaceSlug,+ projectId,+ isEmpty(filteredFilters) ? "init-loader" : "mutation"+ );this.handleIssuesLocalFilters.set(EIssuesStoreType.DRAFT, type, workspaceSlug, projectId, undefined, {filters: _filters.filters,});diff --git a/web/store/issue/module/filter.store.ts b/web/store/issue/module/filter.store.tsindex d7d4d56da9..1e00dc8c0b 100644--- a/web/store/issue/module/filter.store.ts+++ b/web/store/issue/module/filter.store.ts@@ -1,6 +1,8 @@import { action, computed, makeObservable, observable, runInAction } from "mobx";import isEmpty from "lodash/isEmpty";import set from "lodash/set";+import pickBy from "lodash/pickBy";+import isArray from "lodash/isArray";// base classimport { IssueFilterHelperStore } from "../helpers/issue-filter-helper.store";// helpers@@ -157,8 +159,14 @@ export class ModuleIssuesFilter extends IssueFilterHelperStore implements IModulset(this.filters, [moduleId, "filters", _key], updatedFilters[_key as keyof IIssueFilterOptions]);});});-- this.rootIssueStore.moduleIssues.fetchIssues(workspaceSlug, projectId, "mutation", moduleId);+ const appliedFilters = _filters.filters || {};+ const filteredFilters = pickBy(appliedFilters, (value) => value && isArray(value) && value.length > 0);+ this.rootIssueStore.moduleIssues.fetchIssues(+ workspaceSlug,+ projectId,+ isEmpty(filteredFilters) ? "init-loader" : "mutation",+ moduleId+ );await this.issueFilterService.patchModuleIssueFilters(workspaceSlug, projectId, moduleId, {filters: _filters.filters,});diff --git a/web/store/issue/profile/filter.store.ts b/web/store/issue/profile/filter.store.tsindex fe30a1c58e..e7d33c48b2 100644--- a/web/store/issue/profile/filter.store.ts+++ b/web/store/issue/profile/filter.store.ts@@ -1,6 +1,8 @@import { action, computed, makeObservable, observable, runInAction } from "mobx";import isEmpty from "lodash/isEmpty";import set from "lodash/set";+import pickBy from "lodash/pickBy";+import isArray from "lodash/isArray";// base classimport { IssueFilterHelperStore } from "../helpers/issue-filter-helper.store";// helpers@@ -150,13 +152,16 @@ export class ProfileIssuesFilter extends IssueFilterHelperStore implements IProf});});+ const appliedFilters = _filters.filters || {};+ const filteredFilters = pickBy(appliedFilters, (value) => value && isArray(value) && value.length > 0);this.rootIssueStore.profileIssues.fetchIssues(workspaceSlug,undefined,- "mutation",+ isEmpty(filteredFilters) ? "init-loader" : "mutation",userId,this.rootIssueStore.profileIssues.currentView);+this.handleIssuesLocalFilters.set(EIssuesStoreType.PROFILE, type, workspaceSlug, userId, undefined, {filters: _filters.filters,});diff --git a/web/store/issue/project-views/filter.store.ts b/web/store/issue/project-views/filter.store.tsindex 610d92998f..828eca29a1 100644--- a/web/store/issue/project-views/filter.store.ts+++ b/web/store/issue/project-views/filter.store.ts@@ -1,6 +1,8 @@import { action, computed, makeObservable, observable, runInAction } from "mobx";import isEmpty from "lodash/isEmpty";import set from "lodash/set";+import pickBy from "lodash/pickBy";+import isArray from "lodash/isArray";// base classimport { IssueFilterHelperStore } from "../helpers/issue-filter-helper.store";// helpers@@ -159,7 +161,14 @@ export class ProjectViewIssuesFilter extends IssueFilterHelperStore implements I});});- this.rootIssueStore.projectViewIssues.fetchIssues(workspaceSlug, projectId, "mutation", viewId);+ const appliedFilters = _filters.filters || {};+ const filteredFilters = pickBy(appliedFilters, (value) => value && isArray(value) && value.length > 0);+ this.rootIssueStore.projectViewIssues.fetchIssues(+ workspaceSlug,+ projectId,+ isEmpty(filteredFilters) ? "init-loader" : "mutation",+ viewId+ );break;case EIssueFilterType.DISPLAY_FILTERS:const updatedDisplayFilters = filters as IIssueDisplayFilterOptions;diff --git a/web/store/issue/project/filter.store.ts b/web/store/issue/project/filter.store.tsindex 83a95aa6d8..aaa8d81d94 100644--- a/web/store/issue/project/filter.store.ts+++ b/web/store/issue/project/filter.store.ts@@ -1,6 +1,8 @@import { action, computed, makeObservable, observable, runInAction } from "mobx";import isEmpty from "lodash/isEmpty";import set from "lodash/set";+import pickBy from "lodash/pickBy";+import isArray from "lodash/isArray";// base classimport { IssueFilterHelperStore } from "../helpers/issue-filter-helper.store";// helpers@@ -155,7 +157,13 @@ export class ProjectIssuesFilter extends IssueFilterHelperStore implements IProj});});- this.rootIssueStore.projectIssues.fetchIssues(workspaceSlug, projectId, "mutation");+ const appliedFilters = _filters.filters || {};+ const filteredFilters = pickBy(appliedFilters, (value) => value && isArray(value) && value.length > 0);+ this.rootIssueStore.projectIssues.fetchIssues(+ workspaceSlug,+ projectId,+ isEmpty(filteredFilters) ? "init-loader" : "mutation"+ );await this.issueFilterService.patchProjectIssueFilters(workspaceSlug, projectId, {filters: _filters.filters,});diff --git a/web/store/issue/workspace/filter.store.ts b/web/store/issue/workspace/filter.store.tsindex dcacb117ed..95a9a88310 100644--- a/web/store/issue/workspace/filter.store.ts+++ b/web/store/issue/workspace/filter.store.ts@@ -1,6 +1,8 @@import { action, computed, makeObservable, observable, runInAction } from "mobx";import isEmpty from "lodash/isEmpty";import set from "lodash/set";+import pickBy from "lodash/pickBy";+import isArray from "lodash/isArray";// base classimport { IssueFilterHelperStore } from "../helpers/issue-filter-helper.store";// helpers@@ -180,7 +182,13 @@ export class WorkspaceIssuesFilter extends IssueFilterHelperStore implements IWoset(this.filters, [viewId, "filters", _key], updatedFilters[_key as keyof IIssueFilterOptions]);});});- this.rootIssueStore.workspaceIssues.fetchIssues(workspaceSlug, viewId, "mutation");+ const appliedFilters = _filters.filters || {};+ const filteredFilters = pickBy(appliedFilters, (value) => value && isArray(value) && value.length > 0);+ this.rootIssueStore.workspaceIssues.fetchIssues(+ workspaceSlug,+ viewId,+ isEmpty(filteredFilters) ? "init-loader" : "mutation"+ );break;case EIssueFilterType.DISPLAY_FILTERS:const updatedDisplayFilters = filters as IIssueDisplayFilterOptions;