Remove cache clearing from admin server pages
This commit is contained in:
parent
2c1b39fb30
commit
232a7dd67a
@ -34,7 +34,6 @@ import MoreComponentsFromSearchParams from
|
||||
import { getPhotos } from '@/services/vercel-postgres';
|
||||
import PhotoDate from '@/photo/PhotoDate';
|
||||
import { revalidatePath } from 'next/cache';
|
||||
import useSwrClear from '@/state/useSwrClear';
|
||||
|
||||
const DEBUG_PHOTO_BLOBS = false;
|
||||
|
||||
@ -55,8 +54,6 @@ export default async function AdminPhotosPage({
|
||||
|
||||
const showMorePhotos = count > photos.length;
|
||||
|
||||
const clearSwr = useSwrClear();
|
||||
|
||||
return (
|
||||
<SiteGrid
|
||||
contentMain={
|
||||
@ -130,7 +127,6 @@ export default async function AdminPhotosPage({
|
||||
`for "${titleForPhoto(photo)}" from source file? ` +
|
||||
'This action cannot be undone.'
|
||||
}
|
||||
onSubmit={clearSwr}
|
||||
>
|
||||
<input type="hidden" name="id" value={photo.id} />
|
||||
<SubmitButtonWithStatus
|
||||
@ -138,13 +134,11 @@ export default async function AdminPhotosPage({
|
||||
onFormSubmitToastMessage={`
|
||||
"${titleForPhoto(photo)}" EXIF data synced
|
||||
`}
|
||||
onSubmit={clearSwr}
|
||||
/>
|
||||
</FormWithConfirm>
|
||||
<FormWithConfirm
|
||||
action={deletePhotoFormAction}
|
||||
confirmText={deleteConfirmationTextForPhoto(photo)}
|
||||
onSubmit={clearSwr}
|
||||
>
|
||||
<input type="hidden" name="id" value={photo.id} />
|
||||
<input type="hidden" name="url" value={photo.url} />
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
'use client';
|
||||
|
||||
import { useCallback } from 'react';
|
||||
import { useSWRConfig } from 'swr';
|
||||
|
||||
export default function useSwrClear() {
|
||||
const { mutate } = useSWRConfig();
|
||||
return useCallback(() => mutate(
|
||||
_key => false,
|
||||
_key => true,
|
||||
undefined,
|
||||
{ revalidate: false },
|
||||
), [mutate]);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user