Skip to content

Commit

Permalink
Fixed duplicate data fetching overview page + links (#33774)
Browse files Browse the repository at this point in the history
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: Lee Robinson <9113740+leerob@users.noreply.github.com>
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
  • Loading branch information
3 people committed Jan 29, 2022
1 parent 48dee57 commit 1383612
Show file tree
Hide file tree
Showing 19 changed files with 25 additions and 27 deletions.
2 changes: 1 addition & 1 deletion docs/advanced-features/custom-error-page.md
Expand Up @@ -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).
2 changes: 1 addition & 1 deletion docs/api-reference/next.config.js/exportPathMap.md
Expand Up @@ -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`.

Expand Down
2 changes: 1 addition & 1 deletion docs/api-reference/next.config.js/headers.md
Expand Up @@ -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

Expand Down
6 changes: 2 additions & 4 deletions docs/manifest.json
Expand Up @@ -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"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/routing/introduction.md
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion errors/conflicting-ssg-paths.md
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion errors/gsp-redirect-during-prerender.md
Expand Up @@ -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)
6 changes: 3 additions & 3 deletions errors/gssp-export.md
Expand Up @@ -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)
4 changes: 2 additions & 2 deletions errors/gssp-mixed-not-found-redirect.md
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion errors/invalid-redirect-gssp.md
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion errors/page-data-collection-timeout.md
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion errors/prerender-error.md
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion errors/rewrite-auto-export-fallback.md
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions errors/static-page-generation-timeout.md
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion examples/api-routes-apollo-server/README.md
@@ -1,6 +1,6 @@
# 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

Expand Down
4 changes: 2 additions & 2 deletions examples/with-apollo/pages/about.js
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/with-iron-session/README.md
Expand Up @@ -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`).
Expand Down
2 changes: 1 addition & 1 deletion examples/with-iron-session/pages/profile-ssr.tsx
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion examples/with-mux-video/README.md
Expand Up @@ -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

Expand Down

0 comments on commit 1383612

Please sign in to comment.