Unverified Commit 13836120 authored by Rich Haines's avatar Rich Haines Committed by GitHub

Fixed duplicate data fetching overview page + links (#33774)

This PR removes the duplicate overview link for data fetching, and fixes the corresponding links

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
Co-authored-by: 's avatarLee Robinson <9113740+leerob@users.noreply.github.com>
Co-authored-by: 's avatarJJ Kasper <22380829+ijjk@users.noreply.github.com>
parent 48dee57f
......@@ -97,4 +97,4 @@ If you have a custom `Error` component be sure to import that one instead. `next
### Caveats
- `Error` currently does not support Next.js [Data Fetching methods](/docs/basic-features/data-fetching.md) like [`getStaticProps`](/docs/basic-features/data-fetching.md#getstaticprops-static-generation) or [`getServerSideProps`](/docs/basic-features/data-fetching.md#getserversideprops-server-side-rendering).
- `Error` does not currently support Next.js [Data Fetching methods](/docs/basic-features/data-fetching.md) like [`getStaticProps`](/docs/basic-features/data-fetching/get-static-props.md) or [`getServerSideProps`](/docs/basic-features/data-fetching/get-server-side-props.md).
......@@ -40,7 +40,7 @@ module.exports = {
}
```
Note: the `query` field in `exportPathMap` cannot be used with [automatically statically optimized pages](/docs/advanced-features/automatic-static-optimization) or [`getStaticProps` pages](https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation) as they are rendered to HTML files at build-time and additional query information cannot be provided during `next export`.
Note: the `query` field in `exportPathMap` cannot be used with [automatically statically optimized pages](/docs/advanced-features/automatic-static-optimization) or [`getStaticProps` pages](/docs/basic-features/data-fetching/get-static-props.md) as they are rendered to HTML files at build-time and additional query information cannot be provided during `next export`.
The pages will then be exported as HTML files, for example, `/about` will become `/about.html`.
......
......@@ -376,7 +376,7 @@ module.exports = {
### Cache-Control
Cache-Control headers set in next.config.js will be overwritten in production to ensure that static assets can be cached effectively. If you need to revalidate the cache of a page that has been [statically generated](https://nextjs.org/docs/basic-features/pages#static-generation-recommended), you can do so by setting `revalidate` in the page's [`getStaticProps`](https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation) function.
Cache-Control headers set in next.config.js will be overwritten in production to ensure that static assets can be cached effectively. If you need to revalidate the cache of a page that has been [statically generated](https://nextjs.org/docs/basic-features/pages#static-generation-recommended), you can do so by setting `revalidate` in the page's [`getStaticProps`](/docs/basic-features/data-fetching/get-static-props.md) function.
## Related
......
......@@ -17,11 +17,9 @@
"title": "Data Fetching",
"routes": [
{
"title": "Overview",
"path": "/docs/basic-features/data-fetching/index.md",
"path": "/docs/basic-features/data-fetching",
"redirect": {
"destination": "/docs/basic-features/data-fetching/overview.md",
"permanent": true
"destination": "/docs/basic-features/data-fetching/overview"
}
},
{
......
......@@ -74,7 +74,7 @@ The example above uses multiple links. Each one maps a path (`href`) to a known
- `/about` → `pages/about.js`
- `/blog/hello-world` → `pages/blog/[slug].js`
Any `<Link />` in the viewport (initially or through scroll) will be prefetched by default (including the corresponding data) for pages using [Static Generation](/docs/basic-features/data-fetching/get-static-props.md). The corresponding data for [server-rendered](https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering) routes is _not_ prefetched.
Any `<Link />` in the viewport (initially or through scroll) will be prefetched by default (including the corresponding data) for pages using [Static Generation](/docs/basic-features/data-fetching/get-static-props.md). The corresponding data for [server-rendered](/docs/basic-features/data-fetching/get-server-side-props.md) routes is _not_ prefetched.
### Linking to dynamic paths
......
......@@ -65,4 +65,4 @@ export default function CatchAll() {
### Useful Links
- [`getStaticPaths` Documentation](https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation)
- [`getStaticPaths` Documentation](https://nextjs.org/docs/basic-features/data-fetching/get-static-paths.md)
......@@ -10,4 +10,4 @@ Remove any paths that result in a redirect from being prerendered in `getStaticP
### Useful Links
- [Data Fetching Documentation](https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation)
- [Data Fetching Documentation](/docs/basic-features/data-fetching/get-static-props.md)
......@@ -33,6 +33,6 @@ The `getServerSideProps` lifecycle is not compatible with `next export`, so you'
### Useful Links
- [Automatic Static Optimization](https://nextjs.org/docs/advanced-features/automatic-static-optimization)
- [`getStaticProps` documentation](https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation)
- [`exportPathMap` documentation](https://nextjs.org/docs/api-reference/next.config.js/exportPathMap)
- [Automatic Static Optimization](/docs/advanced-features/automatic-static-optimization.md)
- [`getStaticProps` documentation](/docs/basic-features/data-fetching/get-static-props.md)
- [`exportPathMap` documentation](/docs/api-reference/next.config.js/exportPathMap.md)
......@@ -12,5 +12,5 @@ Make sure only `notFound` **or** `redirect` is being returned on your page's `ge
### Useful Links
- [`getStaticProps` Documentation](https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation)
- [`getServerSideProps` Documentation](https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering)
- [`getStaticProps` Documentation](/docs/basic-features/data-fetching/get-static-props.md)
- [`getServerSideProps` Documentation](/docs/basic-features/data-fetching/get-server-side-props.md)
......@@ -29,4 +29,4 @@ export const getStaticProps = ({ params }) => {
### Useful Links
- [Data Fetching Documentation](https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation)
- [Data Fetching Documentation](/docs/basic-features/data-fetching/get-static-props.md)
......@@ -15,4 +15,4 @@ When restarted it will retry all uncompleted jobs, but if a job was unsuccessful
### Useful Links
- [`getStaticPaths`](https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation)
- [`getStaticPaths`](/docs/basic-features/data-fetching/get-static-paths.md)
......@@ -11,4 +11,4 @@ While prerendering a page an error occurred. This can occur for many reasons fro
- Set default values for all dynamic pages' props (avoid `undefined`, use `null` instead so it can be serialized)
- Check for any out of date modules that you might be relying on
- Make sure your component handles `fallback` if it is enabled in `getStaticPaths`. [Fallback docs](https://nextjs.org/docs/api-reference/data-fetching/get-static-paths#fallback-false)
- Make sure you are not trying to export (`next export`) pages that have server-side rendering enabled [(getServerSideProps)](https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering)
- Make sure you are not trying to export (`next export`) pages that have server-side rendering enabled [(getServerSideProps)](/docs/basic-features/data-fetching/get-server-side-props.md)
......@@ -10,7 +10,7 @@ Rewriting to these pages are not yet supported since rewrites are not available
For fallback SSG pages you can add the page to the list of [prerendered paths](https://nextjs.org/docs/basic-features/data-fetching#the-paths-key-required).
For static dynamic routes, you will currently need to either rewrite to non-dynamic route or opt the page out of the static optimization with [`getServerSideProps`](https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering)
For static dynamic routes, you will currently need to either rewrite to non-dynamic route or opt the page out of the static optimization with [`getServerSideProps`](/docs/basic-features/data-fetching/get-server-side-props.md)
### Useful Links
......
......@@ -15,5 +15,5 @@ When restarted it will retry all uncompleted jobs, but if a job was unsuccessful
### Useful Links
- [`getStaticPaths`](https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation)
- [`getStaticProps`](https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation)
- [`getStaticPaths`](https://nextjs.org/docs/basic-features/data-fetching/get-static-paths.md)
- [`getStaticProps`](https://nextjs.org/docs/basic-features/data-fetching/get-static-props.md)
# Consume local Apollo GraphQL schema to create Static Generation export
Next.js ships with two forms of pre-rendering: [Static Generation](https://nextjs.org/docs/basic-features/pages#static-generation-recommended) and [Server-side Rendering](https://nextjs.org/docs/basic-features/pages#server-side-rendering). This example shows how to perform Static Generation using a local [Apollo GraphQL](https://www.apollographql.com/docs/apollo-server/) schema within [getStaticProps](https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation) and [getStaticPaths](https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation). The end result is a Next.js application that uses one Apollo GraphQL schema to generate static pages at build time and also serve a GraphQL [API Route](https://nextjs.org/docs/api-routes/introduction) at runtime.
Next.js ships with two forms of pre-rendering: [Static Generation](https://nextjs.org/docs/basic-features/pages#static-generation-recommended) and [Server-side Rendering](https://nextjs.org/docs/basic-features/pages#server-side-rendering). This example shows how to perform Static Generation using a local [Apollo GraphQL](https://www.apollographql.com/docs/apollo-server/) schema within [getStaticProps](https://nextjs.org/docs/basic-features/data-fetching/get-static-props) and [getStaticPaths](https://nextjs.org/docs/basic-features/data-fetching/get-static-paths.md). The end result is a Next.js application that uses one Apollo GraphQL schema to generate static pages at build time and also serve a GraphQL [API Route](https://nextjs.org/docs/api-routes/introduction) at runtime.
## Preview
......
......@@ -17,7 +17,7 @@ const AboutPage = () => (
<p>
In this simple example, we integrate Apollo seamlessly with{' '}
<a href="https://github.com/vercel/next.js">Next</a> by calling{' '}
<a href="https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation">
<a href="https://nextjs.org/docs/basic-features/data-fetching/get-static-props">
getStaticProps
</a>{' '}
at our Page component. This approach lets us opt out of getInitialProps
......@@ -26,7 +26,7 @@ const AboutPage = () => (
</p>
<p>
On initial page load, while on the server and inside{' '}
<a href="https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation">
<a href="https://nextjs.org/docs/basic-features/data-fetching/get-static-props">
getStaticProps
</a>
, we fetch the query used to get the list of posts. At the point in
......
......@@ -10,7 +10,7 @@ It uses current best practices for authentication in the Next.js ecosystem and r
**Features of the example:**
- [API Routes](https://nextjs.org/docs/api-routes/dynamic-api-routes) and [getServerSideProps](https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering) examples.
- [API Routes](https://nextjs.org/docs/api-routes/dynamic-api-routes) and [getServerSideProps](https://nextjs.org/docs/basic-features/data-fetching/get-server-side-props) examples.
- The logged in status is synchronized between browser windows/tabs using **`useUser`** hook and the [`swr`](https://swr.vercel.app/).
- The layout is based on the user's logged-in/out status.
- The session data is signed and encrypted in a cookie (this is done automatically by `iron-session`).
......
......@@ -18,7 +18,7 @@ export default function SsrProfile({
Server-side Rendering (SSR)
</a>{' '}
and{' '}
<a href="https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering">
<a href="https://nextjs.org/docs/basic-features/data-fetching/get-server-side-props">
getServerSideProps
</a>
</h2>
......
......@@ -32,7 +32,7 @@ This example uses:
- [SWR](https://swr.vercel.app/) — dynamically changing the `refreshInterval` depending on if the client should be polling for updates or not
- [`/pages/api`](pages/api) routes — a couple endpoints for making authenticated requests to the Mux API.
- Dynamic routes using [`getStaticPaths` and `fallback: true`](https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation), as well as dynamic API routes.
- Dynamic routes using [`getStaticPaths` and `fallback: true`](https://nextjs.org/docs/basic-features/data-fetching/get-static-paths), as well as dynamic API routes.
## Configuration
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment