Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs: add correct client detection (#3530)

authored by

Jovi De Croock and committed by
GitHub
ceef9a9b 4078e964

+6 -2
+3 -1
docs/advanced/server-side-rendering.md
··· 237 237 238 238 export default function Layout({ children }: React.PropsWithChildren) { 239 239 const [client, ssr] = useMemo(() => { 240 - const ssr = ssrExchange(); 240 + const ssr = ssrExchange({ 241 + isClient: typeof window !== 'undefined' 242 + }); 241 243 const client = createClient({ 242 244 url: 'https://trygql.formidable.dev/graphql/web-collections', 243 245 exchanges: [cacheExchange, ssr, fetchExchange],
+3 -1
examples/with-next/app/non-rsc/layout.tsx
··· 11 11 12 12 export default function Layout({ children }: React.PropsWithChildren) { 13 13 const [client, ssr] = useMemo(() => { 14 - const ssr = ssrExchange(); 14 + const ssr = ssrExchange({ 15 + isClient: typeof window !== 'undefined', 16 + }); 15 17 const client = createClient({ 16 18 url: 'https://graphql-pokeapi.graphcdn.app/', 17 19 exchanges: [cacheExchange, ssr, fetchExchange],