Skip to content

Commit

Permalink
Update shallow routing docs (#11616)
Browse files Browse the repository at this point in the history
* Updated shallow routing docs

* Include getStaticProps
  • Loading branch information
Luis Alvarez D authored Apr 14, 2020
1 parent 20f6429 commit 2b1f959
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/routing/shallow-routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: You can use shallow routing to change the URL without triggering a
</ul>
</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.

Expand Down Expand Up @@ -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 })
```

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.

0 comments on commit 2b1f959

Please sign in to comment.