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

docs: add correct client detection (#3530)

Changed files
+6 -2
docs
examples
with-next
app
non-rsc
+3 -1
docs/advanced/server-side-rendering.md
···
export default function Layout({ children }: React.PropsWithChildren) {
const [client, ssr] = useMemo(() => {
-
const ssr = ssrExchange();
+
const ssr = ssrExchange({
+
isClient: typeof window !== 'undefined'
+
});
const client = createClient({
url: 'https://trygql.formidable.dev/graphql/web-collections',
exchanges: [cacheExchange, ssr, fetchExchange],
+3 -1
examples/with-next/app/non-rsc/layout.tsx
···
export default function Layout({ children }: React.PropsWithChildren) {
const [client, ssr] = useMemo(() => {
-
const ssr = ssrExchange();
+
const ssr = ssrExchange({
+
isClient: typeof window !== 'undefined',
+
});
const client = createClient({
url: 'https://graphql-pokeapi.graphcdn.app/',
exchanges: [cacheExchange, ssr, fetchExchange],