{"repo":"correttojs/graphql-codegen-apollo-next-ssr","free":true,"listed":false,"github":"https://github.com/correttojs/graphql-codegen-apollo-next-ssr","clone":"git clone https://github.com/correttojs/graphql-codegen-apollo-next-ssr.git","description":"Autogenerate apollo code for nextjs ssr","language":"TypeScript","stars":200,"topics":["graphql","codegen","apollo-client","nextjs","graphql-code-generator","graphql-codegen"],"license":null,"category":"dev-tools","readme_excerpt":"⚠ Maintaner needed ⚠ An alternative solution based on swr and gql-request can be found here graphql-codegen-apollo-next-ssr Generate apollo code for nextjs ssr Motivations Nextjs recently introduced getServerSideProps which doesn't allow to use the HOC pattern adopted by the official apollo graphql plugin (based on getInitialProps ). At the same time the SSR method offered by apollo client ( getDataFromTree ) enforces the react app to render multiple times in order to collect and fetch all the relevant queries. By declaring a top level query we can save rendering time and provide a simpler pattern which works with getServerSideProps . This plugin generates a typesafe version of getServerSideProps for each server query, and the corresponding HOC to wrap the react component returning the cache result. The limitation/advantage of this solution is that all the queries embedded into inner react components are ignored, unless covered by the top level cache. Configuration - excludePatterns (default: null): regexp to exclude operation names - excludePatternsOptions (default: ''): regexp flags to exclude operation names - reactApolloVersion (default: 2): apollo client version - apolloCacheImportFrom (default: apollo-cache-inmemory): apollo-cache-inmemory dependency - apolloImportFrom (default: apollo-client v2 or @apollo/client v3): apollo client dependency - apolloCacheImportFrom (default: apollo-cache-inmemory v2 or @apollo/client v3): apollo cache client dependency - apolloStateKey","default_branch":null,"files":null,"tree":[],"storefront":"/r/correttojs","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/correttojs/graphql-codegen-apollo-next-ssr/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}