Skip to content

Commit

Permalink
doc: Updated nextjs guide and useAtomWithHash docs on useAtomWithHash…
Browse files Browse the repository at this point in the history
… and replaceState (#2183)
  • Loading branch information
joetis06 authored Oct 15, 2023
1 parent 98b1baf commit a77ac88
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/guides/nextjs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ This way you have full control over what [router event](https://nextjs.org/docs/

> #### In Next.js 13
>
> As of Next.js 13 there have been some changes to the `Router.events.on()` which no longer expose events. There are plans in the [App Router Roadmap](https://beta.nextjs.org/docs/app-directory-roadmap#planned-features) for event intercepting and hash handeling. However there is no ETA on when this will be available or what it will look like. For now when trying to the `atomWithHash()` you will not get the atom loading with any data when navigating using the router, only when the page is reloaded or the component is rerendered.
> As of Next.js 13 there have been some changes to the `Router.events.on()` which no longer expose events. There are plans in the [App Router Roadmap](https://beta.nextjs.org/docs/app-directory-roadmap#planned-features) for event intercepting and hash handeling. However there is no ETA on when this will be available or what it will look like. For now when trying to the `atomWithHash()` you will not get the atom loading with any data when navigating using the router, only when the page is reloaded or the component is rerendered. It is also recommended that you set the `setHash` option to `replaceState` as Next.js appears to use window.history in the background and this will allow the user to use the browser back button.
### You can't return promises in server side rendering

Expand Down
2 changes: 1 addition & 1 deletion docs/integrations/location.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ This function works only with DOM.
**subscribe** (optional): custom hash change subscribe function
**setHash** (optional): describes how hash gets updated on the side of the browser. Defaults to pushing a new entry to the history via `window.location.hash = searchParams` ([jotai-location#4](https://github.com/jotaijs/jotai-location/pull/4))
**setHash** (optional): `replaceState` or a custom function that describes how hash gets updated on the side of the browser. Defaults to pushing a new entry to the history via `window.location.hash = searchParams` ([jotai-location#4](https://github.com/jotaijs/jotai-location/pull/4))
### Examples
Expand Down

1 comment on commit a77ac88

@vercel
Copy link

@vercel vercel bot commented on a77ac88 Oct 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.