Skip to content

Commit

Permalink
Fix(#138): invalidateQueries에서 queryOptions 사용 (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
ATeals authored Nov 25, 2024
1 parent eb1ecf2 commit b06ef51
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions apps/frontend/src/widget/lotusCodeRun/CodeRunButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Button } from '@froxy/design/components';
import { useQueryClient } from '@tanstack/react-query';
import { LotusRunCodeForm } from './LotusRunCodeForm';
import { useCodeRunMutation } from '@/feature/history/query';
import { lotusHistoryQueryOptions, useCodeRunMutation } from '@/feature/history/query';
import { ModalBox } from '@/shared';
import { useOverlay } from '@/shared/overlay';

Expand All @@ -18,8 +18,7 @@ export function CodeRunButton({ lotusId }: { lotusId: string }) {
{
onSuccess: () => {
exit();
console.log('생성!');
queryClient.invalidateQueries({ queryKey: ['lotus', 'detail', lotusId, 'history'] });
queryClient.invalidateQueries(lotusHistoryQueryOptions.list({ id: lotusId }));
}
}
);
Expand All @@ -28,7 +27,7 @@ export function CodeRunButton({ lotusId }: { lotusId: string }) {
const handleOpenModal = () =>
open(() => (
<ModalBox onClose={exit}>
<LotusRunCodeForm onCancel={() => close()} onSubmit={handleCodeRun} lotusId={lotusId} />
<LotusRunCodeForm onCancel={() => exit()} onSubmit={handleCodeRun} lotusId={lotusId} />
</ModalBox>
));

Expand Down
4 changes: 2 additions & 2 deletions apps/frontend/src/widget/lotusUpdate/LotusUpdateButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Button, Text } from '@froxy/design/components';
import { useQueryClient } from '@tanstack/react-query';
import { IoSettingsSharp } from 'react-icons/io5';
import { LotusUpdateForm } from './LotusUpdateForm';
import { useLotusUpdateMutation } from '@/feature/lotus';
import { lotusQueryOptions, useLotusUpdateMutation } from '@/feature/lotus';
import { ModalBox } from '@/shared';
import { useOverlay } from '@/shared/overlay';

Expand All @@ -18,7 +18,7 @@ export function LotusUpdateButton({ lotusId }: { lotusId: string }) {
{ body, id: lotusId },
{
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['lotus', 'detail', lotusId] });
queryClient.invalidateQueries(lotusQueryOptions.detail({ id: lotusId }));
}
}
);
Expand Down

0 comments on commit b06ef51

Please sign in to comment.