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

View File

@ -200,7 +200,7 @@ const ProjectCycles: NextPage = () => {
<AllCyclesList viewType={cyclesView} /> <AllCyclesList viewType={cyclesView} />
</Tab.Panel> </Tab.Panel>
{cyclesView !== "gantt_chart" && ( {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] ? ( {currentCycle?.[0] ? (
<ActiveCycleDetails cycle={currentCycle?.[0]} /> <ActiveCycleDetails cycle={currentCycle?.[0]} />
) : ( ) : (

View File

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