diff --git a/package.json b/package.json index 470e8739..02574855 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "react-dom": "18.2.0", "react-icons": "^5.1.0", "sonner": "^1.4.41", - "swr": "^2.2.6-beta.1", + "swr": "^2.2.5", "tailwindcss": "3.4.3", "ts-exif-parser": "^0.2.2", "typescript": "5.4.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a3edacd7..37808d87 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -135,8 +135,8 @@ importers: specifier: ^1.4.41 version: 1.4.41(react-dom@18.2.0(react@18.2.0))(react@18.2.0) swr: - specifier: ^2.2.6-beta.1 - version: 2.2.6-beta.1(react@18.2.0) + specifier: ^2.2.5 + version: 2.2.5(react@18.2.0) tailwindcss: specifier: 3.4.3 version: 3.4.3 @@ -3773,8 +3773,8 @@ packages: peerDependencies: react: ^16.11.0 || ^17.0.0 || ^18.0.0 - swr@2.2.6-beta.1: - resolution: {integrity: sha512-YqC6vjeuHoGnx2JSMK/sophBhqO7+oQPNRM9kHWZ0mpb3RtyeqTmRr5osBywZHd24muvLziroPjYY60h/nuohw==} + swr@2.2.5: + resolution: {integrity: sha512-QtxqyclFeAsxEUeZIYmsaQ0UjimSq1RZ9Un7I68/0ClKK/U3LoyQunwkQfJZr2fc22DfIXLNDc2wFyTEikCUpg==} peerDependencies: react: ^16.11.0 || ^17.0.0 || ^18.0.0 @@ -8741,8 +8741,9 @@ snapshots: react: 18.2.0 use-sync-external-store: 1.2.0(react@18.2.0) - swr@2.2.6-beta.1(react@18.2.0): + swr@2.2.5(react@18.2.0): dependencies: + client-only: 0.0.1 react: 18.2.0 use-sync-external-store: 1.2.0(react@18.2.0) diff --git a/src/admin/AdminPhotoMenuClient.tsx b/src/admin/AdminPhotoMenuClient.tsx index 1caf2f7b..d2b20097 100644 --- a/src/admin/AdminPhotoMenuClient.tsx +++ b/src/admin/AdminPhotoMenuClient.tsx @@ -10,7 +10,6 @@ import { usePathname } from 'next/navigation'; import { BiTrash } from 'react-icons/bi'; import MoreMenu from '@/components/MoreMenu'; import { useAppState } from '@/state/AppState'; -import { useSWRConfig } from 'swr'; export default function AdminPhotoMenuClient({ photo, @@ -25,8 +24,6 @@ export default function AdminPhotoMenuClient({ const shouldRedirectFav = isPathFavs(path) && isFav; const shouldRedirectDelete = pathForPhoto(photo.id) === path; - const { mutate } = useSWRConfig(); - return ( isUserSignedIn ? toggleFavoritePhotoAction( photo.id, shouldRedirectFav, - ).then(() => { - if (photo.cacheKey) { mutate(photo.cacheKey); } - }), + ), }, { label: 'Delete', icon: 0 ?
+
diff --git a/src/photo/InfinitePhotoScroll.tsx b/src/photo/InfinitePhotoScroll.tsx index 822b1a8c..06db08fd 100644 --- a/src/photo/InfinitePhotoScroll.tsx +++ b/src/photo/InfinitePhotoScroll.tsx @@ -8,10 +8,8 @@ import SiteGrid from '@/components/SiteGrid'; import Spinner from '@/components/Spinner'; import { getPhotosAction } from '@/photo/actions'; import { useAppState } from '@/state/AppState'; -import { Photo } from '.'; export default function InfinitePhotoScroll({ - initialPhotos, key = 'PHOTOS', initialOffset = 0, itemsPerPage = 12, @@ -19,7 +17,6 @@ export default function InfinitePhotoScroll({ triggerOnView = true, debug = true, }: { - initialPhotos?: Photo[] key?: string initialOffset?: number itemsPerPage?: number @@ -50,7 +47,6 @@ export default function InfinitePhotoScroll({ revalidateOnFocus: isUserSignedIn, revalidateOnReconnect: isUserSignedIn, revalidateFirstPage: isUserSignedIn, - ...initialPhotos && { fallbackData: [initialPhotos] }, }, ); @@ -88,20 +84,21 @@ export default function InfinitePhotoScroll({
{photos && } {!isFinished && - mutate() : advance} - disabled={isLoading} - className="w-full flex justify-center" - > - {error - ? 'Try Again' - : isLoading - ? - : 'Load More'} - - } />} + mutate() : advance} + disabled={isLoading} + className="w-full flex justify-center" + > + {error + ? 'Try Again' + : isLoading + ? + : 'Load More'} + + } />}
); }