mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
93c59f02f8
## For Contributors ### Fixing a bug - Fixes #(open or reference an issue if one exists, otherwise omit) - No tests required — this is an `examples/` change only - No custom error links needed — failures are surfaced via Apollo's built-in error state --- ## Summary - `PostList` destructured `data` before checking `loading`/`error`, so the component threw when `data` was `undefined` (e.g., on the initial fetch or after a query error) instead of showing the loading/error UI. - Move the `error`/`loading`/`!data` guard clauses above the `data` destructuring and `loadMorePosts` definition, and add a `!data` check so the component never accesses properties on an undefined value. - Bump `graphql` (`14.5.8` → `16.13.1`) and `lodash` (`4.17.20` → `4.17.23`) in the example's `package.json` to pick up fixes in dependencies the example relies on. ## Note: Initially this PR suppose to target upstream DB issue
Apollo & Redux Example
This example serves as a conduit if you were using Apollo 1.X with Redux, and are migrating to Apollo 3.x, however, you have chosen not to manage your entire application state within Apollo (apollo-link-state).
In 3.0.0, Apollo serves out-of-the-box support for redux in favor of Apollo's state management. This example aims to be an amalgamation of the with-apollo and with-redux examples.
To inspect the GraphQL API, use its web IDE.
Deploy your own
How to use
Execute create-next-app with npm, Yarn, or pnpm to bootstrap the example:
npx create-next-app --example with-apollo-and-redux with-apollo-and-redux-app
yarn create next-app --example with-apollo-and-redux with-apollo-and-redux-app
pnpm create next-app --example with-apollo-and-redux with-apollo-and-redux-app
Deploy it to the cloud with Vercel (Documentation).