Unverified Commit 2b1f959b authored by Luis Alvarez D's avatar Luis Alvarez D Committed by GitHub

Update shallow routing docs (#11616)

* Updated shallow routing docs

* Include getStaticProps
parent 20f64296
...@@ -11,7 +11,7 @@ description: You can use shallow routing to change the URL without triggering a ...@@ -11,7 +11,7 @@ description: You can use shallow routing to change the URL without triggering a
</ul> </ul>
</details> </details>
Shallow routing allows you to change the URL without running [`getInitialProps`](/docs/api-reference/data-fetching/getInitialProps.md). Shallow routing allows you to change the URL without running data fetching methods again, that includes [`getServerSideProps`](/docs/basic-features/data-fetching.md#getserversideprops-server-side-rendering), [`getStaticProps`](/docs/basic-features/data-fetching.md#getstaticprops-static-generation), and [`getInitialProps`](/docs/api-reference/data-fetching/getInitialProps.md).
You'll receive the updated `pathname` and the `query` via the [`router` object](/docs/api-reference/next/router.md#router-object) (added by [`useRouter`](/docs/api-reference/next/router.md#useRouter) or [`withRouter`](/docs/api-reference/next/router.md#withRouter)), without losing state. You'll receive the updated `pathname` and the `query` via the [`router` object](/docs/api-reference/next/router.md#router-object) (added by [`useRouter`](/docs/api-reference/next/router.md#useRouter) or [`withRouter`](/docs/api-reference/next/router.md#withRouter)), without losing state.
...@@ -68,4 +68,4 @@ Shallow routing **only** works for same page URL changes. For example, let's ass ...@@ -68,4 +68,4 @@ Shallow routing **only** works for same page URL changes. For example, let's ass
Router.push('/?counter=10', '/about?counter=10', { shallow: true }) Router.push('/?counter=10', '/about?counter=10', { shallow: true })
``` ```
Since that's a new page, it'll unload the current page, load the new one and call `getInitialProps` even though we asked to do shallow routing. Since that's a new page, it'll unload the current page, load the new one and wait for data fetching even though we asked to do shallow routing.
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