feat(seo): slugged show urls, sr-only homepage intro, ISR detail pages
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ce630cd029
commit
735c63471a
11 files changed
+103
-28
No files matched your search
+14
-1
@@ -1,3 +1,4 @@
|
||||
import { cache } from 'react';
|
||||
import { isServer, QueryClient } from '@tanstack/react-query';
|
||||
|
||||
const makeQueryClient = () => {
|
||||
@@ -15,8 +16,20 @@ const makeQueryClient = () => {
|
||||
|
||||
let browserQueryClient: QueryClient | undefined = undefined;
|
||||
|
||||
// One client per server request (React cache is request-scoped), so generateMetadata
|
||||
// and the page share fetches instead of hitting TMDB twice for the same data.
|
||||
const getServerQueryClient = cache(makeQueryClient);
|
||||
|
||||
const getQueryClient = () => {
|
||||
if (isServer) return makeQueryClient();
|
||||
if (isServer) {
|
||||
try {
|
||||
return getServerQueryClient();
|
||||
} catch (_) {
|
||||
// cache() only works in the RSC runtime; the SSR pass of client components
|
||||
// (e.g. Providers) lands here and keeps its own per-render client as before
|
||||
return makeQueryClient();
|
||||
}
|
||||
}
|
||||
|
||||
if (!browserQueryClient) browserQueryClient = makeQueryClient();
|
||||
|
||||
|
||||
Reference in new issue
Block a user