[WEB-1686] fix: issues incorrect filters while switching between, projects, modules etc (#4904)
* fix issues incorrect filters while switching between, projects, modules etc * fix minor kanban pagination loader
This commit is contained in:
parent
dcdd1ef065
commit
adec4e1f2d
24 changed files with 224 additions and 82 deletions
|
|
@ -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(() => (
|
||||
<BaseCalendarRoot QuickActions={ProjectIssueQuickActions} />
|
||||
));
|
||||
export const ProjectViewCalendarLayout: React.FC = observer(() => {
|
||||
const { viewId } = useParams();
|
||||
|
||||
return <BaseCalendarRoot QuickActions={ProjectIssueQuickActions} viewId={viewId.toString()} />;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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(() => (
|
||||
<BaseKanBanRoot QuickActions={ProjectIssueQuickActions} />
|
||||
));
|
||||
export const ProjectViewKanBanLayout: React.FC = observer(() => {
|
||||
const { viewId } = useParams();
|
||||
|
||||
return <BaseKanBanRoot QuickActions={ProjectIssueQuickActions} viewId={viewId.toString()} />;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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(() => <BaseListRoot QuickActions={ProjectIssueQuickActions} />);
|
||||
export const ProjectViewListLayout: React.FC = observer(() => {
|
||||
const { viewId } = useParams();
|
||||
|
||||
return <BaseListRoot QuickActions={ProjectIssueQuickActions} viewId={viewId.toString()} />;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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 <ProjectViewListLayout />;
|
||||
|
|
@ -61,7 +61,7 @@ export const ProjectViewLayoutRoot: React.FC = observer(() => {
|
|||
<div className="relative flex h-full w-full flex-col overflow-hidden">
|
||||
<ProjectViewAppliedFiltersRoot />
|
||||
<div className="relative h-full w-full overflow-auto">
|
||||
<ProjectViewIssueLayout activeLayout={activeLayout} />
|
||||
<ProjectViewIssueLayout activeLayout={activeLayout} viewId={viewId.toString()} />
|
||||
</div>
|
||||
|
||||
{/* peek overview */}
|
||||
|
|
|
|||
|
|
@ -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(() => (
|
||||
<BaseSpreadsheetRoot QuickActions={ProjectIssueQuickActions} />
|
||||
));
|
||||
export const ProjectViewSpreadsheetLayout: React.FC = observer(() => {
|
||||
const { viewId } = useParams();
|
||||
|
||||
return <BaseSpreadsheetRoot QuickActions={ProjectIssueQuickActions} viewId={viewId.toString()} />;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -20,17 +20,20 @@ export interface IProjectViewIssues extends IBaseIssuesStore {
|
|||
fetchIssues: (
|
||||
workspaceSlug: string,
|
||||
projectId: string,
|
||||
viewId: string,
|
||||
loadType: TLoader,
|
||||
options: IssuePaginationOptions
|
||||
) => Promise<TIssuesResponse | undefined>;
|
||||
fetchIssuesWithExistingPagination: (
|
||||
workspaceSlug: string,
|
||||
projectId: string,
|
||||
viewId: string,
|
||||
loadType: TLoader
|
||||
) => Promise<TIssuesResponse | undefined>;
|
||||
fetchNextIssues: (
|
||||
workspaceSlug: string,
|
||||
projectId: string,
|
||||
viewId: string,
|
||||
groupId?: string,
|
||||
subGroupId?: string
|
||||
) => Promise<TIssuesResponse | undefined>;
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ export interface IWorkspaceIssuesFilter extends IBaseIssueFilterStore {
|
|||
getIssueFilters: (viewId: string | undefined) => IIssueFilters | undefined;
|
||||
getAppliedFilters: (viewId: string) => Partial<Record<TIssueParams, string | boolean>> | 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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue