From c9ca262da85872f8634fb61163ef6464e83b7f50 Mon Sep 17 00:00:00 2001 From: ner Date: Tue, 29 Oct 2024 18:25:52 +0200 Subject: [PATCH] fix: back to prefetch --- app/(site)/container.tsx | 10 ++++++++-- app/(site)/favorites/page.tsx | 22 ++++++++++++++++++++-- app/(site)/page.tsx | 19 ++++++++++++++++++- app/(site)/popular/page.tsx | 15 ++++++++++++++- app/(site)/similar/page.tsx | 24 +++++++++++++++++++++++- app/(site)/starring/page.tsx | 29 ++++++++++++++++++++++++++++- app/(site)/top/page.tsx | 15 ++++++++++++++- app/(site)/watch-list/page.tsx | 22 ++++++++++++++++++++-- components/Random/index.tsx | 10 ++++++++-- components/Random/useRandomMovie.ts | 8 ++++++-- data/queries/random.ts | 13 +++++++++---- hooks/useInfiniteList.ts | 16 ++++++++++------ lib/queryClient.ts | 2 +- public/sw.js | 2 +- 14 files changed, 180 insertions(+), 27 deletions(-) diff --git a/app/(site)/container.tsx b/app/(site)/container.tsx index cc8eb54..d1bd635 100644 --- a/app/(site)/container.tsx +++ b/app/(site)/container.tsx @@ -1,10 +1,16 @@ +import { FC } from 'react'; + import Random from '@/components/Random'; import Trending from '@/components/Trending'; -const Container = () => ( +interface Props { + page: number; +} + +const Container: FC = ({ page }) => (
- +
diff --git a/app/(site)/favorites/page.tsx b/app/(site)/favorites/page.tsx index 0d98beb..7e3faf9 100644 --- a/app/(site)/favorites/page.tsx +++ b/app/(site)/favorites/page.tsx @@ -1,14 +1,32 @@ +import { dehydrate, HydrationBoundary } from '@tanstack/react-query'; import { Metadata } from 'next'; import UsersList from '@/components/UsersLists'; -import { session } from '@/data'; +import { session as getSession } from '@/data'; +import usersShowsQuery from '@/data/queries/usersShows'; import { TITLE } from '@/env'; +import getQueryClient from '@/lib/queryClient'; export const metadata: Metadata = { title: `My Favorite Shows - ${TITLE}`, description: `View your favorite shows on ${TITLE}. Keep track of films you’ve added and revisit your top picks anytime.` }; -const Favorites = async () => ; +const Favorites = async () => { + const session = await getSession(); + const queryClient = getQueryClient(); + + const list = 'favorite'; + + if (session) { + queryClient.prefetchInfiniteQuery(usersShowsQuery({ showType: 'movie', session, list })); + } + + return ( + + + + ); +}; export default Favorites; diff --git a/app/(site)/page.tsx b/app/(site)/page.tsx index 306021a..49505f8 100644 --- a/app/(site)/page.tsx +++ b/app/(site)/page.tsx @@ -1,5 +1,22 @@ +import { dehydrate, HydrationBoundary } from '@tanstack/react-query'; + +import randomQuery, { generatePage } from '@/data/queries/random'; +import getQueryClient from '@/lib/queryClient'; + import Container from './container'; -const Random = () => ; +const Random = () => { + const queryClient = getQueryClient(); + + const page = generatePage(); + + queryClient.prefetchInfiniteQuery(randomQuery({ page })); + + return ( + + + + ); +}; export default Random; diff --git a/app/(site)/popular/page.tsx b/app/(site)/popular/page.tsx index 76be957..1b79ef9 100644 --- a/app/(site)/popular/page.tsx +++ b/app/(site)/popular/page.tsx @@ -1,6 +1,9 @@ +import { dehydrate, HydrationBoundary } from '@tanstack/react-query'; import { Metadata } from 'next'; +import popularQuery from '@/data/queries/popular'; import { TITLE } from '@/env'; +import getQueryClient from '@/lib/queryClient'; import Container from './container'; @@ -9,6 +12,16 @@ export const metadata: Metadata = { description: `Check out the most popular movies right now on ${TITLE}. See what’s trending and don’t miss out on the latest hits.` }; -const Popular = () => ; +const Popular = () => { + const queryClient = getQueryClient(); + + queryClient.prefetchInfiniteQuery(popularQuery()); + + return ( + + + + ); +}; export default Popular; diff --git a/app/(site)/similar/page.tsx b/app/(site)/similar/page.tsx index 08c2ad0..76ea774 100644 --- a/app/(site)/similar/page.tsx +++ b/app/(site)/similar/page.tsx @@ -1,5 +1,27 @@ +import { FC } from 'react'; +import { dehydrate, HydrationBoundary } from '@tanstack/react-query'; + +import similarQuery from '@/data/queries/similar'; +import getQueryClient from '@/lib/queryClient'; + import Container from './container'; -const Similar = () => ; +interface Props { + searchParams: { id: string; type: Show['type'] }; +} + +const Similar: FC = ({ searchParams }) => { + const queryClient = getQueryClient(); + + const { id, type } = searchParams || {}; + + queryClient.prefetchInfiniteQuery(similarQuery({ showId: id, showType: type })); + + return ( + + + + ); +}; export default Similar; diff --git a/app/(site)/starring/page.tsx b/app/(site)/starring/page.tsx index 8690762..add1fd0 100644 --- a/app/(site)/starring/page.tsx +++ b/app/(site)/starring/page.tsx @@ -1,5 +1,32 @@ +import { FC } from 'react'; +import { dehydrate, HydrationBoundary } from '@tanstack/react-query'; + +import popularQuery from '@/data/queries/popular'; +import getQueryClient from '@/lib/queryClient'; + import Container from './container'; -const Starring = () => ; +interface Props { + searchParams: Record; +} + +const Starring: FC = ({ searchParams }) => { + const queryClient = getQueryClient(); + + const { actorId } = searchParams || {}; + + queryClient.prefetchInfiniteQuery( + popularQuery({ + sortBy: 'vote_average.desc', + starring: actorId + }) + ); + + return ( + + + + ); +}; export default Starring; diff --git a/app/(site)/top/page.tsx b/app/(site)/top/page.tsx index 804e675..890814e 100644 --- a/app/(site)/top/page.tsx +++ b/app/(site)/top/page.tsx @@ -1,6 +1,9 @@ +import { dehydrate, HydrationBoundary } from '@tanstack/react-query'; import { Metadata } from 'next'; +import popularQuery from '@/data/queries/popular'; import { TITLE } from '@/env'; +import getQueryClient from '@/lib/queryClient'; import Container from './container'; @@ -9,6 +12,16 @@ export const metadata: Metadata = { description: `Discover the top-rated movies on ${TITLE}. Find the highest-rated films and make informed viewing choices.` }; -const Top = () => ; +const Top = () => { + const queryClient = getQueryClient(); + + queryClient.prefetchInfiniteQuery(popularQuery({ sortBy: 'vote_average.desc' })); + + return ( + + + + ); +}; export default Top; diff --git a/app/(site)/watch-list/page.tsx b/app/(site)/watch-list/page.tsx index 0bc3d9c..31a2918 100644 --- a/app/(site)/watch-list/page.tsx +++ b/app/(site)/watch-list/page.tsx @@ -1,14 +1,32 @@ +import { dehydrate, HydrationBoundary } from '@tanstack/react-query'; import { Metadata } from 'next'; import UsersList from '@/components/UsersLists'; -import { session } from '@/data'; +import { session as getSession, session } from '@/data'; +import usersShowsQuery from '@/data/queries/usersShows'; import { TITLE } from '@/env'; +import getQueryClient from '@/lib/queryClient'; export const metadata: Metadata = { title: `My watch list - ${TITLE}`, description: `View your favorite shows on ${TITLE}. Keep track of films you’ve added and revisit your top picks anytime.` }; -const WatchList = async () => ; +const WatchList = async () => { + const session = await getSession(); + const queryClient = getQueryClient(); + + const list = 'watchlist'; + + if (session) { + queryClient.prefetchInfiniteQuery(usersShowsQuery({ showType: 'movie', session, list })); + } + + return ( + + + + ); +}; export default WatchList; diff --git a/components/Random/index.tsx b/components/Random/index.tsx index dc1ad59..5fc1ac2 100644 --- a/components/Random/index.tsx +++ b/components/Random/index.tsx @@ -1,12 +1,18 @@ 'use client'; +import { FC } from 'react'; + import Preview from '../Preview'; import Carousel from './components/Carousel'; import useRandomMovie from './useRandomMovie'; -const Random = () => { - const { movie, movies, onIndexChange, fetchNextPage } = useRandomMovie(); +interface Props { + page: number; +} + +const Random: FC = ({ page }) => { + const { movie, movies, onIndexChange, fetchNextPage } = useRandomMovie({ page }); return ( getDefaultStore().get(indexAtom); -const useRandomMovie = () => { +interface Props { + page: number; +} + +const useRandomMovie = ({ page }: Props) => { const [index, setIndex] = useAtom(indexAtom); - const { shows: movies, fetchNextPage } = useInfiniteList(randomQuery()); + const { shows: movies, fetchNextPage } = useInfiniteList(randomQuery({ page })); if (movies.length && !movies[index]) { setIndex(0); diff --git a/data/queries/random.ts b/data/queries/random.ts index 1613254..3cf23e5 100644 --- a/data/queries/random.ts +++ b/data/queries/random.ts @@ -7,18 +7,23 @@ const TOTAL_PAGES = 400; export const generatePage = createUniqueRandomGenerator(TOTAL_PAGES); -const randomQuery = () => ({ +export type RandomQueryProps = { + page: number; +}; + +const randomQuery = ({ page }: RandomQueryProps) => ({ suspense: true, queryKey: ['random-movie'], - initialPageParam: '1', - queryFn: () => + initialPageParam: page.toString(), + getNextPageParam: () => generatePage().toString(), + queryFn: ({ pageParam }: { pageParam: string }) => movieAdvisor .get>('/discover/movie', { params: { 'vote_count.gte': 300, sort_by: 'popularity.desc', with_origin_country: 'UA|GB|JP|AU|US|IT|DE|FR', - page: generatePage() + page: pageParam } }) .then(mapMoviesSeriesResponseToShows) diff --git a/hooks/useInfiniteList.ts b/hooks/useInfiniteList.ts index 6d71915..681c84d 100644 --- a/hooks/useInfiniteList.ts +++ b/hooks/useInfiniteList.ts @@ -6,21 +6,25 @@ interface Props { queryKey: QueryKey; enabled?: boolean; queryFn: ({ pageParam }: { pageParam: string }) => Promise>; + initialPageParam?: string; + getNextPageParam?: () => string | undefined; } -const useInfiniteList = ({ queryKey, queryFn, enabled, suspense }: Props) => { +const useInfiniteList = ({ queryKey, queryFn, enabled, suspense, initialPageParam, getNextPageParam }: Props) => { const { data, hasNextPage, fetchNextPage, isFetched, isLoading } = ( suspense ? useSuspenseInfiniteQuery : useInfiniteQuery )({ enabled, queryKey, queryFn: ({ pageParam }) => queryFn({ pageParam }), - getNextPageParam(pagination) { - if (!pagination || pagination.page === pagination.total) return undefined; + getNextPageParam: + getNextPageParam || + ((pagination) => { + if (!pagination || pagination.page === pagination.total) return undefined; - return `${pagination.page + 1}`; - }, - initialPageParam: '1' + return `${pagination.page + 1}`; + }), + initialPageParam: initialPageParam ?? '1' }); const shows = useMemo(() => { diff --git a/lib/queryClient.ts b/lib/queryClient.ts index c0e1052..bd7403f 100644 --- a/lib/queryClient.ts +++ b/lib/queryClient.ts @@ -4,7 +4,7 @@ const makeQueryClient = () => { return new QueryClient({ defaultOptions: { queries: { - staleTime: Infinity, + staleTime: 3600 * 1000, refetchOnReconnect: false, refetchOnMount: false, refetchOnWindowFocus: false diff --git a/public/sw.js b/public/sw.js index 25d2dc8..88f1042 100644 --- a/public/sw.js +++ b/public/sw.js @@ -1 +1 @@ -if(!self.define){let e,a={};const s=(s,n)=>(s=new URL(s+".js",n).href,a[s]||new Promise((a=>{if("document"in self){const e=document.createElement("script");e.src=s,e.onload=a,document.head.appendChild(e)}else e=s,importScripts(s),a()})).then((()=>{let e=a[s];if(!e)throw new Error(`Module ${s} didn’t register its module`);return e})));self.define=(n,t)=>{const i=e||("document"in self?document.currentScript.src:"")||location.href;if(a[i])return;let c={};const r=e=>s(e,i),o={module:{uri:i},exports:c,require:r};a[i]=Promise.all(n.map((e=>o[e]||r(e)))).then((e=>(t(...e),c)))}}define(["./workbox-4754cb34"],(function(e){"use strict";importScripts(),self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"/_next/app-build-manifest.json",revision:"2a57774e1ed6331c1395fd1ea2d7b22c"},{url:"/_next/static/chunks/132-9c5907bb6e658bd4.js",revision:"mwtiyaWB8nTaaSMQ6ajGA"},{url:"/_next/static/chunks/152.362c71763f5f1192.js",revision:"362c71763f5f1192"},{url:"/_next/static/chunks/23-e0259c2123520d87.js",revision:"mwtiyaWB8nTaaSMQ6ajGA"},{url:"/_next/static/chunks/26.286553a5ff2812fc.js",revision:"286553a5ff2812fc"},{url:"/_next/static/chunks/276.c3c1130f2adade69.js",revision:"c3c1130f2adade69"},{url:"/_next/static/chunks/344.05938a041227e582.js",revision:"05938a041227e582"},{url:"/_next/static/chunks/383.78d47f7582340f53.js",revision:"78d47f7582340f53"},{url:"/_next/static/chunks/460.ac20021c7496f1d6.js",revision:"ac20021c7496f1d6"},{url:"/_next/static/chunks/497.48f1dfd129122432.js",revision:"48f1dfd129122432"},{url:"/_next/static/chunks/584-87bcccb137b07dd4.js",revision:"mwtiyaWB8nTaaSMQ6ajGA"},{url:"/_next/static/chunks/61.e269d4a699fba0b6.js",revision:"e269d4a699fba0b6"},{url:"/_next/static/chunks/617-ef0cc8cd639c8a92.js",revision:"mwtiyaWB8nTaaSMQ6ajGA"},{url:"/_next/static/chunks/621-fa4d2ff1cf645813.js",revision:"mwtiyaWB8nTaaSMQ6ajGA"},{url:"/_next/static/chunks/673.362c29137dd3e968.js",revision:"362c29137dd3e968"},{url:"/_next/static/chunks/695.156d21364de6e419.js",revision:"156d21364de6e419"},{url:"/_next/static/chunks/755.5cd959eac5682527.js",revision:"5cd959eac5682527"},{url:"/_next/static/chunks/792.b51012549074b93f.js",revision:"b51012549074b93f"},{url:"/_next/static/chunks/810.6105e84414768b0d.js",revision:"6105e84414768b0d"},{url:"/_next/static/chunks/922.9ce4bf0553cfb724.js",revision:"9ce4bf0553cfb724"},{url:"/_next/static/chunks/app/(site)/favorites/page-d41cd989d3aca261.js",revision:"mwtiyaWB8nTaaSMQ6ajGA"},{url:"/_next/static/chunks/app/(site)/loading-96645736797edde7.js",revision:"mwtiyaWB8nTaaSMQ6ajGA"},{url:"/_next/static/chunks/app/(site)/page-b696c31e16ee2a97.js",revision:"mwtiyaWB8nTaaSMQ6ajGA"},{url:"/_next/static/chunks/app/(site)/popular/page-8f35320a3ee7322d.js",revision:"mwtiyaWB8nTaaSMQ6ajGA"},{url:"/_next/static/chunks/app/(site)/similar/page-6c052528908c0b81.js",revision:"mwtiyaWB8nTaaSMQ6ajGA"},{url:"/_next/static/chunks/app/(site)/starring/page-7f395dbf442510bd.js",revision:"mwtiyaWB8nTaaSMQ6ajGA"},{url:"/_next/static/chunks/app/(site)/top/page-8b739e20efddb8bf.js",revision:"mwtiyaWB8nTaaSMQ6ajGA"},{url:"/_next/static/chunks/app/(site)/watch-list/page-0e517d3ae10f5b63.js",revision:"mwtiyaWB8nTaaSMQ6ajGA"},{url:"/_next/static/chunks/app/_not-found/page-97bde446d7f1c840.js",revision:"mwtiyaWB8nTaaSMQ6ajGA"},{url:"/_next/static/chunks/app/layout-951f602929e02aa5.js",revision:"mwtiyaWB8nTaaSMQ6ajGA"},{url:"/_next/static/chunks/c8bcbd21.63daf74955ffea8b.js",revision:"63daf74955ffea8b"},{url:"/_next/static/chunks/fd9d1056-d1448f0cd0a3dc26.js",revision:"mwtiyaWB8nTaaSMQ6ajGA"},{url:"/_next/static/chunks/framework-f66176bb897dc684.js",revision:"mwtiyaWB8nTaaSMQ6ajGA"},{url:"/_next/static/chunks/main-a339d49e77d6dbd3.js",revision:"mwtiyaWB8nTaaSMQ6ajGA"},{url:"/_next/static/chunks/main-app-51cdaff1a81e6b49.js",revision:"mwtiyaWB8nTaaSMQ6ajGA"},{url:"/_next/static/chunks/pages/_app-6a626577ffa902a4.js",revision:"mwtiyaWB8nTaaSMQ6ajGA"},{url:"/_next/static/chunks/pages/_error-1be831200e60c5c0.js",revision:"mwtiyaWB8nTaaSMQ6ajGA"},{url:"/_next/static/chunks/polyfills-42372ed130431b0a.js",revision:"846118c33b2c0e922d7b3a7676f81f6f"},{url:"/_next/static/chunks/webpack-cc221c8a98e29fdd.js",revision:"mwtiyaWB8nTaaSMQ6ajGA"},{url:"/_next/static/css/0d5f6452b2682b9b.css",revision:"0d5f6452b2682b9b"},{url:"/_next/static/css/de5e7a9d0c8570d7.css",revision:"de5e7a9d0c8570d7"},{url:"/_next/static/media/a9b1453781eac9e6-s.p.woff2",revision:"c754cf60aba699077f00948285bf54b5"},{url:"/_next/static/media/dd843ebd3ff03195-s.p.woff2",revision:"333341dc4117f45b7fcee6b5223a56db"},{url:"/_next/static/media/e9ecf55e71a874cd-s.woff2",revision:"62348655e2d5baed97a39f0590491d09"},{url:"/_next/static/mwtiyaWB8nTaaSMQ6ajGA/_buildManifest.js",revision:"2ec694eb52ae4f523f265a46bae4d768"},{url:"/_next/static/mwtiyaWB8nTaaSMQ6ajGA/_ssgManifest.js",revision:"b6652df95db52feb4daf4eca35380933"},{url:"/apple-touch-icon.png",revision:"6ed7ad78b222698b2872b5a7f104fe08"},{url:"/favicon-48x48.png",revision:"d2db6eb5ce8ce1da63114250c9652da7"},{url:"/favicon.ico",revision:"d7c46eb2b2574863f72315ed861b1c99"},{url:"/favicon.svg",revision:"15b76ab693bd3a8320d8f8778332d396"},{url:"/manifest.json",revision:"5707bda32aaccb2ce142908f0baf8a1b"},{url:"/web-app-manifest-192x192.png",revision:"5d8538e4362b4ddbd7ff195fb24c25dc"},{url:"/web-app-manifest-512x512.png",revision:"e0a092cab607727cbe6f61adb0b1e6cf"}],{ignoreURLParametersMatching:[]}),e.cleanupOutdatedCaches(),e.registerRoute("/",new e.NetworkFirst({cacheName:"start-url",plugins:[{cacheWillUpdate:async({request:e,response:a,event:s,state:n})=>a&&"opaqueredirect"===a.type?new Response(a.body,{status:200,statusText:"OK",headers:a.headers}):a}]}),"GET"),e.registerRoute(/^https:\/\/fonts\.(?:gstatic)\.com\/.*/i,new e.CacheFirst({cacheName:"google-fonts-webfonts",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:31536e3})]}),"GET"),e.registerRoute(/^https:\/\/fonts\.(?:googleapis)\.com\/.*/i,new e.StaleWhileRevalidate({cacheName:"google-fonts-stylesheets",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:604800})]}),"GET"),e.registerRoute(/\.(?:eot|otf|ttc|ttf|woff|woff2|font.css)$/i,new e.StaleWhileRevalidate({cacheName:"static-font-assets",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:604800})]}),"GET"),e.registerRoute(/\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i,new e.StaleWhileRevalidate({cacheName:"static-image-assets",plugins:[new e.ExpirationPlugin({maxEntries:64,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\/_next\/image\?url=.+$/i,new e.StaleWhileRevalidate({cacheName:"next-image",plugins:[new e.ExpirationPlugin({maxEntries:64,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:mp3|wav|ogg)$/i,new e.CacheFirst({cacheName:"static-audio-assets",plugins:[new e.RangeRequestsPlugin,new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:mp4)$/i,new e.CacheFirst({cacheName:"static-video-assets",plugins:[new e.RangeRequestsPlugin,new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:js)$/i,new e.StaleWhileRevalidate({cacheName:"static-js-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:css|less)$/i,new e.StaleWhileRevalidate({cacheName:"static-style-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\/_next\/data\/.+\/.+\.json$/i,new e.StaleWhileRevalidate({cacheName:"next-data",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:json|xml|csv)$/i,new e.NetworkFirst({cacheName:"static-data-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>{if(!(self.origin===e.origin))return!1;const a=e.pathname;return!a.startsWith("/api/auth/")&&!!a.startsWith("/api/")}),new e.NetworkFirst({cacheName:"apis",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:16,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>{if(!(self.origin===e.origin))return!1;return!e.pathname.startsWith("/api/")}),new e.NetworkFirst({cacheName:"others",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>!(self.origin===e.origin)),new e.NetworkFirst({cacheName:"cross-origin",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:3600})]}),"GET")})); +if(!self.define){let e,s={};const n=(n,c)=>(n=new URL(n+".js",c).href,s[n]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=s,document.head.appendChild(e)}else e=n,importScripts(n),s()})).then((()=>{let e=s[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e})));self.define=(c,t)=>{const i=e||("document"in self?document.currentScript.src:"")||location.href;if(s[i])return;let a={};const f=e=>n(e,i),r={module:{uri:i},exports:a,require:f};s[i]=Promise.all(c.map((e=>r[e]||f(e)))).then((e=>(t(...e),a)))}}define(["./workbox-4754cb34"],(function(e){"use strict";importScripts(),self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"/_next/app-build-manifest.json",revision:"80761954100f0b6a7bab0d9ae3d0c3b6"},{url:"/_next/static/BpfE9Xvc9qCfRFOyDYgsh/_buildManifest.js",revision:"2ec694eb52ae4f523f265a46bae4d768"},{url:"/_next/static/BpfE9Xvc9qCfRFOyDYgsh/_ssgManifest.js",revision:"b6652df95db52feb4daf4eca35380933"},{url:"/_next/static/chunks/132-f8dec67d40375666.js",revision:"BpfE9Xvc9qCfRFOyDYgsh"},{url:"/_next/static/chunks/152.b96372f7a5392cef.js",revision:"b96372f7a5392cef"},{url:"/_next/static/chunks/209-af7fe75ba3786fd1.js",revision:"BpfE9Xvc9qCfRFOyDYgsh"},{url:"/_next/static/chunks/23-e0259c2123520d87.js",revision:"BpfE9Xvc9qCfRFOyDYgsh"},{url:"/_next/static/chunks/26.286553a5ff2812fc.js",revision:"286553a5ff2812fc"},{url:"/_next/static/chunks/261-53daa415084fcdbe.js",revision:"BpfE9Xvc9qCfRFOyDYgsh"},{url:"/_next/static/chunks/276.c3c1130f2adade69.js",revision:"c3c1130f2adade69"},{url:"/_next/static/chunks/344.05938a041227e582.js",revision:"05938a041227e582"},{url:"/_next/static/chunks/383.78d47f7582340f53.js",revision:"78d47f7582340f53"},{url:"/_next/static/chunks/460.ac20021c7496f1d6.js",revision:"ac20021c7496f1d6"},{url:"/_next/static/chunks/497.48f1dfd129122432.js",revision:"48f1dfd129122432"},{url:"/_next/static/chunks/61.e269d4a699fba0b6.js",revision:"e269d4a699fba0b6"},{url:"/_next/static/chunks/621-fa4d2ff1cf645813.js",revision:"BpfE9Xvc9qCfRFOyDYgsh"},{url:"/_next/static/chunks/673.362c29137dd3e968.js",revision:"362c29137dd3e968"},{url:"/_next/static/chunks/680-c4b2a24305eaa584.js",revision:"BpfE9Xvc9qCfRFOyDYgsh"},{url:"/_next/static/chunks/695.156d21364de6e419.js",revision:"156d21364de6e419"},{url:"/_next/static/chunks/755.5cd959eac5682527.js",revision:"5cd959eac5682527"},{url:"/_next/static/chunks/792.b51012549074b93f.js",revision:"b51012549074b93f"},{url:"/_next/static/chunks/810.6105e84414768b0d.js",revision:"6105e84414768b0d"},{url:"/_next/static/chunks/922.9ce4bf0553cfb724.js",revision:"9ce4bf0553cfb724"},{url:"/_next/static/chunks/app/(site)/favorites/page-964a24e9ccc42f58.js",revision:"BpfE9Xvc9qCfRFOyDYgsh"},{url:"/_next/static/chunks/app/(site)/loading-96645736797edde7.js",revision:"BpfE9Xvc9qCfRFOyDYgsh"},{url:"/_next/static/chunks/app/(site)/page-4a80ee2d1b5eb1be.js",revision:"BpfE9Xvc9qCfRFOyDYgsh"},{url:"/_next/static/chunks/app/(site)/popular/page-34f5dc8e221f0fe9.js",revision:"BpfE9Xvc9qCfRFOyDYgsh"},{url:"/_next/static/chunks/app/(site)/similar/page-971819b71cfe3acc.js",revision:"BpfE9Xvc9qCfRFOyDYgsh"},{url:"/_next/static/chunks/app/(site)/starring/page-c125517f46fc2e39.js",revision:"BpfE9Xvc9qCfRFOyDYgsh"},{url:"/_next/static/chunks/app/(site)/top/page-3f8b273dfc73f0e7.js",revision:"BpfE9Xvc9qCfRFOyDYgsh"},{url:"/_next/static/chunks/app/(site)/watch-list/page-e65d1fdadc60de11.js",revision:"BpfE9Xvc9qCfRFOyDYgsh"},{url:"/_next/static/chunks/app/_not-found/page-97bde446d7f1c840.js",revision:"BpfE9Xvc9qCfRFOyDYgsh"},{url:"/_next/static/chunks/app/layout-e0c515cb893afbfd.js",revision:"BpfE9Xvc9qCfRFOyDYgsh"},{url:"/_next/static/chunks/c8bcbd21.63daf74955ffea8b.js",revision:"63daf74955ffea8b"},{url:"/_next/static/chunks/fd9d1056-d1448f0cd0a3dc26.js",revision:"BpfE9Xvc9qCfRFOyDYgsh"},{url:"/_next/static/chunks/framework-f66176bb897dc684.js",revision:"BpfE9Xvc9qCfRFOyDYgsh"},{url:"/_next/static/chunks/main-a339d49e77d6dbd3.js",revision:"BpfE9Xvc9qCfRFOyDYgsh"},{url:"/_next/static/chunks/main-app-51cdaff1a81e6b49.js",revision:"BpfE9Xvc9qCfRFOyDYgsh"},{url:"/_next/static/chunks/pages/_app-6a626577ffa902a4.js",revision:"BpfE9Xvc9qCfRFOyDYgsh"},{url:"/_next/static/chunks/pages/_error-1be831200e60c5c0.js",revision:"BpfE9Xvc9qCfRFOyDYgsh"},{url:"/_next/static/chunks/polyfills-42372ed130431b0a.js",revision:"846118c33b2c0e922d7b3a7676f81f6f"},{url:"/_next/static/chunks/webpack-2727b4b69a6c8e6c.js",revision:"BpfE9Xvc9qCfRFOyDYgsh"},{url:"/_next/static/css/0d5f6452b2682b9b.css",revision:"0d5f6452b2682b9b"},{url:"/_next/static/css/de5e7a9d0c8570d7.css",revision:"de5e7a9d0c8570d7"},{url:"/_next/static/media/a9b1453781eac9e6-s.p.woff2",revision:"c754cf60aba699077f00948285bf54b5"},{url:"/_next/static/media/dd843ebd3ff03195-s.p.woff2",revision:"333341dc4117f45b7fcee6b5223a56db"},{url:"/_next/static/media/e9ecf55e71a874cd-s.woff2",revision:"62348655e2d5baed97a39f0590491d09"},{url:"/apple-touch-icon.png",revision:"6ed7ad78b222698b2872b5a7f104fe08"},{url:"/favicon-48x48.png",revision:"d2db6eb5ce8ce1da63114250c9652da7"},{url:"/favicon.ico",revision:"d7c46eb2b2574863f72315ed861b1c99"},{url:"/favicon.svg",revision:"15b76ab693bd3a8320d8f8778332d396"},{url:"/manifest.json",revision:"5707bda32aaccb2ce142908f0baf8a1b"},{url:"/web-app-manifest-192x192.png",revision:"5d8538e4362b4ddbd7ff195fb24c25dc"},{url:"/web-app-manifest-512x512.png",revision:"e0a092cab607727cbe6f61adb0b1e6cf"}],{ignoreURLParametersMatching:[]}),e.cleanupOutdatedCaches(),e.registerRoute("/",new e.NetworkFirst({cacheName:"start-url",plugins:[{cacheWillUpdate:async({request:e,response:s,event:n,state:c})=>s&&"opaqueredirect"===s.type?new Response(s.body,{status:200,statusText:"OK",headers:s.headers}):s}]}),"GET"),e.registerRoute(/^https:\/\/fonts\.(?:gstatic)\.com\/.*/i,new e.CacheFirst({cacheName:"google-fonts-webfonts",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:31536e3})]}),"GET"),e.registerRoute(/^https:\/\/fonts\.(?:googleapis)\.com\/.*/i,new e.StaleWhileRevalidate({cacheName:"google-fonts-stylesheets",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:604800})]}),"GET"),e.registerRoute(/\.(?:eot|otf|ttc|ttf|woff|woff2|font.css)$/i,new e.StaleWhileRevalidate({cacheName:"static-font-assets",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:604800})]}),"GET"),e.registerRoute(/\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i,new e.StaleWhileRevalidate({cacheName:"static-image-assets",plugins:[new e.ExpirationPlugin({maxEntries:64,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\/_next\/image\?url=.+$/i,new e.StaleWhileRevalidate({cacheName:"next-image",plugins:[new e.ExpirationPlugin({maxEntries:64,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:mp3|wav|ogg)$/i,new e.CacheFirst({cacheName:"static-audio-assets",plugins:[new e.RangeRequestsPlugin,new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:mp4)$/i,new e.CacheFirst({cacheName:"static-video-assets",plugins:[new e.RangeRequestsPlugin,new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:js)$/i,new e.StaleWhileRevalidate({cacheName:"static-js-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:css|less)$/i,new e.StaleWhileRevalidate({cacheName:"static-style-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\/_next\/data\/.+\/.+\.json$/i,new e.StaleWhileRevalidate({cacheName:"next-data",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:json|xml|csv)$/i,new e.NetworkFirst({cacheName:"static-data-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>{if(!(self.origin===e.origin))return!1;const s=e.pathname;return!s.startsWith("/api/auth/")&&!!s.startsWith("/api/")}),new e.NetworkFirst({cacheName:"apis",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:16,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>{if(!(self.origin===e.origin))return!1;return!e.pathname.startsWith("/api/")}),new e.NetworkFirst({cacheName:"others",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>!(self.origin===e.origin)),new e.NetworkFirst({cacheName:"cross-origin",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:3600})]}),"GET")}));