From a11cddc6becd339ebef5a94c0cab075a055221d9 Mon Sep 17 00:00:00 2001 From: Jono Hewitt <47791294+jonohewitt@users.noreply.github.com> Date: Wed, 10 Aug 2022 02:13:48 +0200 Subject: [PATCH 1/2] Update `router.prefetch` documentation Include documentation for setting the locale as an option within `router.prefetch`. --- docs/api-reference/next/router.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/api-reference/next/router.md b/docs/api-reference/next/router.md index f9f3ac0e602a648..453726bb4d02f52 100644 --- a/docs/api-reference/next/router.md +++ b/docs/api-reference/next/router.md @@ -256,6 +256,8 @@ router.prefetch(url, as) - `url` - The URL to prefetch, including explicit routes (e.g. `/dashboard`) and dynamic routes (e.g. `/product/[id]`) - `as` - Optional decorator for `url`. Before Next.js 9.5.3 this was used to prefetch dynamic routes, check our [previous docs](https://nextjs.org/docs/tag/v9.5.2/api-reference/next/link#dynamic-routes) to see how it worked +- `options` - Optional object with the following configuration options: + - `locale` - The active locale is automatically prepended. `locale` allows for providing a different locale. When `false` `url` has to include the locale as the default behavior is disabled. #### Usage From 0d683772f8577b64ba3b6dee71425fe64815382f Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Tue, 9 Aug 2022 19:37:21 -0500 Subject: [PATCH 2/2] apply suggestions --- docs/api-reference/next/router.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/api-reference/next/router.md b/docs/api-reference/next/router.md index 453726bb4d02f52..e068a85e479acc6 100644 --- a/docs/api-reference/next/router.md +++ b/docs/api-reference/next/router.md @@ -248,16 +248,16 @@ export default function Page() { Prefetch pages for faster client-side transitions. This method is only useful for navigations without [`next/link`](/docs/api-reference/next/link.md), as `next/link` takes care of prefetching pages automatically. -> This is a production only feature. Next.js doesn't prefetch pages on development. +> This is a production only feature. Next.js doesn't prefetch pages in development. ```jsx -router.prefetch(url, as) +router.prefetch(url, as, options) ``` - `url` - The URL to prefetch, including explicit routes (e.g. `/dashboard`) and dynamic routes (e.g. `/product/[id]`) - `as` - Optional decorator for `url`. Before Next.js 9.5.3 this was used to prefetch dynamic routes, check our [previous docs](https://nextjs.org/docs/tag/v9.5.2/api-reference/next/link#dynamic-routes) to see how it worked -- `options` - Optional object with the following configuration options: - - `locale` - The active locale is automatically prepended. `locale` allows for providing a different locale. When `false` `url` has to include the locale as the default behavior is disabled. +- `options` - Optional object with the following allowed fields: + - `locale` - allows providing a different locale from the active one. If `false`, `url` has to include the locale as the active locale won't be used. #### Usage