fix: clear auction cache after cancellation

This commit is contained in:
dahyeon committed 2026-06-23 03:43:12 -07:00
1 parent 7c372f0392
commit c6f5a7077f
2 files changed
+25 -12

No files matched your search

+23 -11
View File
@@ -786,19 +786,31 @@ export default function AuctionPage() {
const historyBackTo = `${location.pathname}${location.search}${location.hash}`; const historyBackTo = `${location.pathname}${location.search}${location.hash}`;
const canConfirmAuctionCancel = cancelConfirmText.trim() === '예'; const canConfirmAuctionCancel = cancelConfirmText.trim() === '예';
async function invalidateAuctionData() { async function clearAuctionDataAfterCancel() {
if (!id) return; if (!id) return;
const auctionQueryKey = ['auction', DEFAULT_COMMUNITY_ID, id] as const;
const auctionHistoryQueryKey = [
'auction-history',
DEFAULT_COMMUNITY_ID,
id,
] as const;
await Promise.all([ await Promise.all([
queryClient.invalidateQueries({ queryClient.cancelQueries({ queryKey: auctionQueryKey, exact: true }),
queryKey: ['auction', DEFAULT_COMMUNITY_ID, id], queryClient.cancelQueries({
}), queryKey: auctionHistoryQueryKey,
queryClient.invalidateQueries({ exact: true,
queryKey: ['auction-history', DEFAULT_COMMUNITY_ID, id],
}),
queryClient.invalidateQueries({
queryKey: ['match', DEFAULT_COMMUNITY_ID, id],
}), }),
]); ]);
queryClient.removeQueries({ queryKey: auctionQueryKey, exact: true });
queryClient.removeQueries({
queryKey: auctionHistoryQueryKey,
exact: true,
});
await queryClient.invalidateQueries({
queryKey: ['match', DEFAULT_COMMUNITY_ID, id],
exact: true,
});
} }
useEffect(() => { useEffect(() => {
@@ -848,7 +860,7 @@ export default function AuctionPage() {
useEffect(() => { useEffect(() => {
if (!socket.resetAt || !id) return; if (!socket.resetAt || !id) return;
void invalidateAuctionData().finally(() => { void clearAuctionDataAfterCancel().finally(() => {
navigate(`/match/${id}`, { replace: true }); navigate(`/match/${id}`, { replace: true });
}); });
}, [id, navigate, socket.resetAt]); }, [id, navigate, socket.resetAt]);
@@ -959,7 +971,7 @@ export default function AuctionPage() {
onSuccess: async () => { onSuccess: async () => {
setShowCancelModal(false); setShowCancelModal(false);
setCancelConfirmText(''); setCancelConfirmText('');
await invalidateAuctionData(); await clearAuctionDataAfterCancel();
navigate(`/match/${id}`, { replace: true }); navigate(`/match/${id}`, { replace: true });
}, },
}, },
+2 -1
View File
@@ -2752,7 +2752,8 @@ export default function MatchDetailPage() {
meQuery.isLoading || (meQuery.isFetching && !meQuery.data); meQuery.isLoading || (meQuery.isFetching && !meQuery.data);
const auctionNotStarted = const auctionNotStarted =
auctionQuery.error instanceof ApiError && auctionQuery.error.status === 404; auctionQuery.error instanceof ApiError && auctionQuery.error.status === 404;
const showAuctionLink = Boolean(auctionQuery.data); const activeAuction = auctionNotStarted ? null : auctionQuery.data;
const showAuctionLink = Boolean(activeAuction);
const auctionParticipantPool = buildAuctionParticipantPool( const auctionParticipantPool = buildAuctionParticipantPool(
matchQuery.data.participants, matchQuery.data.participants,
); );