refractor: added params to fetch key (#465)

This commit is contained in:
Dakshesh Jain 2023-03-16 18:15:08 +05:30 committed by GitHub
parent 23c468786d
commit 0fb9a14f15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 81 additions and 34 deletions

View file

@ -425,19 +425,35 @@ export const IssueViewContextProvider: React.FC<{ children: React.ReactNode }> =
}, [myViewProps, viewDetails]);
useEffect(() => {
const params: any = {
order_by: state.orderBy,
group_by: state.groupByProperty,
assignees: state.filters?.assignees ? state.filters?.assignees.join(",") : undefined,
state: state.filters?.state ? state.filters?.state.join(",") : undefined,
priority: state.filters?.priority ? state.filters?.priority.join(",") : undefined,
type: state.filters?.type ? state.filters?.type : undefined,
labels: state.filters?.labels ? state.filters?.labels.join(",") : undefined,
issue__assignees__id: state.filters?.issue__assignees__id
? state.filters?.issue__assignees__id.join(",")
: undefined,
issue__labels__id: state.filters?.issue__labels__id
? state.filters?.issue__labels__id.join(",")
: undefined,
};
// TODO: think of a better way to do this
if (cycleId) {
mutate(CYCLE_ISSUES_WITH_PARAMS(cycleId as string), {}, false);
mutate(CYCLE_ISSUES_WITH_PARAMS(cycleId as string));
mutate(CYCLE_ISSUES_WITH_PARAMS(cycleId as string, params), {}, false);
mutate(CYCLE_ISSUES_WITH_PARAMS(cycleId as string, params));
} else if (moduleId) {
mutate(MODULE_ISSUES_WITH_PARAMS(moduleId as string), {}, false);
mutate(MODULE_ISSUES_WITH_PARAMS(moduleId as string));
mutate(MODULE_ISSUES_WITH_PARAMS(moduleId as string, params), {}, false);
mutate(MODULE_ISSUES_WITH_PARAMS(moduleId as string, params));
} else if (viewId) {
mutate(VIEW_ISSUES(viewId as string), {}, false);
mutate(VIEW_ISSUES(viewId as string));
} else {
mutate(PROJECT_ISSUES_LIST_WITH_PARAMS(projectId as string), {}, false);
mutate(PROJECT_ISSUES_LIST_WITH_PARAMS(projectId as string));
mutate(PROJECT_ISSUES_LIST_WITH_PARAMS(projectId as string, params), {}, false);
mutate(PROJECT_ISSUES_LIST_WITH_PARAMS(projectId as string, params));
}
}, [state, projectId, cycleId, moduleId, viewId]);