Invalidate swr when clearing cache
This commit is contained in:
parent
bd0f61f237
commit
730f7f07ee
@ -2,13 +2,17 @@
|
|||||||
|
|
||||||
import SubmitButtonWithStatus from '@/components/SubmitButtonWithStatus';
|
import SubmitButtonWithStatus from '@/components/SubmitButtonWithStatus';
|
||||||
import { syncCacheAction } from '@/photo/actions';
|
import { syncCacheAction } from '@/photo/actions';
|
||||||
|
import { useAppState } from '@/state/AppState';
|
||||||
import { BiTrash } from 'react-icons/bi';
|
import { BiTrash } from 'react-icons/bi';
|
||||||
|
|
||||||
export default function ClearCacheButton() {
|
export default function ClearCacheButton() {
|
||||||
|
const { invalidateSwr } = useAppState();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form action={syncCacheAction}>
|
<form action={syncCacheAction}>
|
||||||
<SubmitButtonWithStatus
|
<SubmitButtonWithStatus
|
||||||
icon={<BiTrash />}
|
icon={<BiTrash />}
|
||||||
|
onFormSubmit={invalidateSwr}
|
||||||
>
|
>
|
||||||
Clear Cache
|
Clear Cache
|
||||||
</SubmitButtonWithStatus>
|
</SubmitButtonWithStatus>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user