chore: fetch only high priority issues for the active cycle (#1228)

This commit is contained in:
Aaryan Khandelwal 2023-06-07 19:03:02 +05:30 committed by GitHub
parent 78c1a64690
commit e949c4e130
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 10 deletions

View file

@ -41,11 +41,10 @@ import { truncateText } from "helpers/string.helper";
// types
import { ICycle, IIssue } from "types";
// fetch-keys
import { CURRENT_CYCLE_LIST, CYCLES_LIST, CYCLE_ISSUES } from "constants/fetch-keys";
import { CURRENT_CYCLE_LIST, CYCLES_LIST, CYCLE_ISSUES_WITH_PARAMS } from "constants/fetch-keys";
type TSingleStatProps = {
cycle: ICycle;
isCompleted?: boolean;
};
const stateGroups = [
@ -76,7 +75,7 @@ const stateGroups = [
},
];
export const ActiveCycleDetails: React.FC<TSingleStatProps> = ({ cycle, isCompleted = false }) => {
export const ActiveCycleDetails: React.FC<TSingleStatProps> = ({ cycle }) => {
const router = useRouter();
const { workspaceSlug, projectId } = router.query;
@ -165,17 +164,20 @@ export const ActiveCycleDetails: React.FC<TSingleStatProps> = ({ cycle, isComple
});
};
const { data: issues } = useSWR<IIssue[]>(
workspaceSlug && projectId && cycle.id ? CYCLE_ISSUES(cycle.id as string) : null,
const { data: issues } = useSWR(
workspaceSlug && projectId && cycle.id
? CYCLE_ISSUES_WITH_PARAMS(cycle.id, { priority: "high" })
: null,
workspaceSlug && projectId && cycle.id
? () =>
cyclesService.getCycleIssues(
cyclesService.getCycleIssuesWithParams(
workspaceSlug as string,
projectId as string,
cycle.id as string
cycle.id,
{ priority: "high" }
)
: null
);
) as { data: IIssue[] };
const progressIndicatorData = stateGroups.map((group, index) => ({
id: index,