rsnext/examples/with-apollo
Henrik Wenz a79bcfb73a
Fix with-apollo example (#17686)
# Issue

The cache updates are performed in a wrong way, resulting in a duplicate collection:

**Error:**

```log
webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:88 Warning: Encountered two children with the same key, `6f3f7265-0d97-4708-a3ea-7dee76dc0a0a`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.
```

**Video:**

![broken](https://user-images.githubusercontent.com/1265681/95336501-0c170180-08b1-11eb-9273-6ac9e37ceb41.gif)

# Fix

**Video:**

![fixed](https://user-images.githubusercontent.com/1265681/95336538-15a06980-08b1-11eb-8d5e-6acc07e16138.gif)
2020-10-08 03:45:28 +00:00
..
components Fix with-apollo example (#17686) 2020-10-08 03:45:28 +00:00
lib Update with-apollo examples to merge existing cache (#15804) 2020-08-05 11:30:29 -04:00
pages Update Apollo example for 9.5 (#15546) 2020-07-28 01:16:08 -04:00
.gitignore Added .gitignore to examples that are deployed to vercel (#15127) 2020-07-16 10:52:23 -04:00
package.json chore: update example names to match their folders (#16268) 2020-09-05 21:23:51 +00:00
README.md Simplify example usage instructions (#16678) 2020-08-29 22:22:02 -04:00

Apollo Example

Apollo is a GraphQL client that allows you to easily query the exact data you need from a GraphQL server. In addition to fetching and mutating data, Apollo analyzes your queries and their results to construct a client-side cache of your data, which is kept up to date as further queries and mutations are run.

In this simple example, we integrate Apollo seamlessly with Next.js data fetching methods to fetch queries in the server and hydrate them in the browser.

This example relies on Prisma + Nexus for its GraphQL backend.

Demo

https://next-with-apollo.now.sh

Deploy your own

Deploy the example using Vercel:

Deploy with Vercel

How to use

Execute create-next-app with npm or Yarn to bootstrap the example:

npx create-next-app --example with-apollo with-apollo-app
# or
yarn create next-app --example with-apollo with-apollo-app

Deploy it to the cloud with Vercel (Documentation).