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,

View File

@ -200,7 +200,7 @@ const ProjectCycles: NextPage = () => {
<AllCyclesList viewType={cyclesView} />
</Tab.Panel>
{cyclesView !== "gantt_chart" && (
<Tab.Panel as="div" className="mt-7 space-y-5">
<Tab.Panel as="div" className="mt-7 space-y-5 h-full overflow-y-auto">
{currentCycle?.[0] ? (
<ActiveCycleDetails cycle={currentCycle?.[0]} />
) : (

View File

@ -77,7 +77,7 @@ class ProjectCycleServices extends APIService {
workspaceSlug: string,
projectId: string,
cycleId: string,
queries?: Partial<IIssueViewOptions>
queries?: any
): Promise<IIssue[] | { [key: string]: IIssue[] }> {
return this.get(
`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/cycle-issues/`,