Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/feature/create-album/components/CreateInputList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import DateXInput from '@/global/components/DateXInput';
import XInput from '@/global/components/XInput';
import { format } from 'date-fns';
import { useState } from 'react';

interface CreateInputListProps {
Expand Down Expand Up @@ -75,12 +76,7 @@ export default function CreateInputList({
onErrorChange?.(error !== '' || eventNameError !== '');
};

// 로컬 시간대 기준으로 오늘 날짜를 YYYY-MM-DD로 계산
const todayDate = new Date();
const yyyy = todayDate.getFullYear();
const mm = String(todayDate.getMonth() + 1).padStart(2, '0'); // 0-11이므로 +1
const dd = String(todayDate.getDate()).padStart(2, '0');
const today = `${yyyy}-${mm}-${dd}`;
const today = format(new Date(), 'yyyy-MM-dd');

return (
<div className='flex flex-col gap-6 px-4'>
Expand Down
8 changes: 0 additions & 8 deletions src/feature/photo-detail/components/FooterPhotoDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@ export default function FooterPhotoDetail({
photoId,
});

console.log(
'🗑️ FooterPhotoDetail - canDelete:',
photoDetail?.canDelete,
'photoId:',
photoId,
);

const { mutateAsync: mutateAsyncLike, isPending: isLiking } =
usePhotoLikedMutation();
const { mutateAsync: mutateAsyncUnlike, isPending: isUnliking } =
Expand All @@ -62,7 +55,6 @@ export default function FooterPhotoDetail({
try {
await mutateAsyncDelete({ albumId, photoId });
queryClient.invalidateQueries({ queryKey: [EP.album.photos(albumId)] });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

사진 삭제 후 photos 쿼리만 무효화하고 있습니다. 이로 인해 다른 관련 데이터(예: 좋아요 목록, 앨범 정보 등)가 오래된 상태로 남아있을 수 있습니다. 사진 삭제 시 앨범과 관련된 모든 쿼리를 무효화하여 데이터 정합성을 보장하는 것이 좋습니다.

photoDetail 쿼리를 무효화하면 현재 상세 페이지가 자동으로 업데이트되어 '삭제된 사진'임을 사용자에게 알리는 로직을 구현할 수도 있습니다.

      queryClient.invalidateQueries({ queryKey: [EP.album.photos(albumId)] });
      queryClient.invalidateQueries({ queryKey: [EP.album.photoDetail(albumId, photoId)] });
      queryClient.invalidateQueries({ queryKey: [EP.album.likedPhotos(albumId)] });
      queryClient.invalidateQueries({ queryKey: [EP.album.albumBest-4cut(albumId)] });
      queryClient.invalidateQueries({ queryKey: [EP.album.availableCount(albumId)] });
      queryClient.invalidateQueries({ queryKey: [EP.album.albumInfo(albumId)] });

setIsPhotoInfoOpen(false);
} catch (e) {
console.error(e);
Toast.alert('사진 삭제에 실패했습니다.');
Expand Down
Loading