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.

support per page layout from next (#2065)

authored by

Jovi De Croock and committed by
GitHub
4fa44e59 25584258

+20 -1
+5
.changeset/spotty-bees-beam.md
··· 1 + --- 2 + 'next-urql': minor 3 + --- 4 + 5 + Support forwarding the getLayout function from pages
+15 -1
packages/next-urql/src/with-urql-client.ts
··· 1 - import { createElement, useCallback, useReducer, useMemo } from 'react'; 1 + import { 2 + createElement, 3 + useCallback, 4 + useReducer, 5 + useMemo, 6 + ReactNode, 7 + ReactElement, 8 + } from 'react'; 2 9 import ssrPrepass from 'react-ssr-prepass'; 3 10 import { NextComponentType, NextPage, NextPageContext } from 'next'; 4 11 import NextApp, { AppContext } from 'next/app'; ··· 22 29 } from './types'; 23 30 24 31 let ssr: SSRExchange; 32 + type NextPageWithLayout = NextPage & { 33 + getLayout?: (page: ReactElement) => ReactNode; 34 + }; 25 35 26 36 export function withUrqlClient( 27 37 getClientConfig: NextUrqlClientConfig, ··· 100 110 const displayName = 101 111 (AppOrPage as any).displayName || AppOrPage.name || 'Component'; 102 112 WithUrql.displayName = `withUrqlClient(${displayName})`; 113 + 114 + if ((AppOrPage as NextPageWithLayout).getLayout) { 115 + WithUrql.getLayout = (AppOrPage as NextPageWithLayout).getLayout; 116 + } 103 117 104 118 if (AppOrPage.getInitialProps || options!.ssr) { 105 119 WithUrql.getInitialProps = async (appOrPageCtx: NextUrqlContext) => {