Skip to content

Commit

Permalink
Merge pull request #380 from boostcampwm-2024/feat/#379/query-cache
Browse files Browse the repository at this point in the history
[Fix] 캐시로 인해 완료된 AI 요약본을 가져오지 못하는 오류수정
  • Loading branch information
seoko97 authored Dec 5, 2024
2 parents f270ccb + b8431db commit 0ca54b5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
11 changes: 6 additions & 5 deletions apps/web/src/components/dashboard/open/ApplicantsDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import { DashboardApplicantsResponse } from '@repo/types';

import Avatar from '@/components/common/Avatar';
import { Dialog } from '@/components/common/Dialog';
import Empty from '@/components/common/Empty';
import { useApplicantsTicle } from '@/hooks/api/dashboard';

interface ApplicantsDialogProps {
ticleId: number;
isOpen: boolean;
onClose: () => void;
applicants: DashboardApplicantsResponse;
}

function ApplicantsDialog({ isOpen, onClose, applicants }: ApplicantsDialogProps) {
function ApplicantsDialog({ ticleId, isOpen, onClose }: ApplicantsDialogProps) {
const { data: applicants } = useApplicantsTicle(ticleId.toString());

return (
<Dialog.Root isOpen={isOpen} onClose={onClose}>
<Dialog.Title align="center">신청자 목록</Dialog.Title>
<Dialog.Close onClose={onClose} />
<Dialog.Content className="custom-scrollbar h-56 overflow-y-scroll">
<ul className="flex h-full flex-col gap-4">
{applicants.length === 0 ? (
{!applicants || applicants.length === 0 ? (
<Empty imageSize={80} className="h-full" />
) : (
applicants.map((applicant) => (
Expand Down
5 changes: 1 addition & 4 deletions apps/web/src/components/dashboard/open/TicleInfoCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,11 @@ function TicleInfoCard({
onClose: onAiSummaryDialogClose,
} = useModal();

const { data: applicantsData } = useApplicantsTicle(ticleId.toString());
const { mutate: ticleStartMutate } = useStartTicle();
const { dateStr, timeRangeStr } = formatDateTimeRange(startTime, endTime);

const navigate = useNavigate();

if (!applicantsData) return;

const handleTicleStart = (e: MouseEvent<HTMLButtonElement>) => {
e.preventDefault();
ticleStartMutate(ticleId.toString());
Expand Down Expand Up @@ -115,9 +112,9 @@ function TicleInfoCard({
</div>
{isApplicantsDialogOpen && (
<ApplicantsDialog
ticleId={ticleId}
onClose={onApplicantsDialogClose}
isOpen={isApplicantsDialogOpen}
applicants={applicantsData}
/>
)}
{isAiSummaryDialogOpen && (
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/hooks/api/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const useApplicantsTicle = (ticleId: string) => {
queryKey: ['applicantsTicle', ticleId],
queryFn: () => getApplicantsTicle(ticleId),
enabled: !!ticleId,
staleTime: 0,
});
};

Expand All @@ -39,6 +40,7 @@ export const useAiSummary = (ticleId: string) => {
queryKey: ['aiSummary', ticleId],
queryFn: () => getAiSummary(ticleId),
enabled: !!ticleId,
staleTime: 0,
});
};

Expand Down

0 comments on commit 0ca54b5

Please sign in to comment.