From 37f5c095211f8826bb2251baebd1d879eca5df62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=8B=E3=81=8C=E3=81=BF?= Date: Fri, 4 Oct 2024 09:24:01 +0800 Subject: [PATCH 1/2] docs: add a note for useHydrateAtoms client code usage (#2761) --- docs/utilities/ssr.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/utilities/ssr.mdx b/docs/utilities/ssr.mdx index 2d35d52656..346d54ae5b 100644 --- a/docs/utilities/ssr.mdx +++ b/docs/utilities/ssr.mdx @@ -24,6 +24,8 @@ const CounterPage = ({ countFromServer }) => { The primary use case for `useHydrateAtoms` are SSR apps like Next.js, where an initial value is e.g. fetched on the server, which can be passed to a component by props. +⚠️ Note: Although the term "hydrate" might suggest server-side usage, this hook is designed for client-side code and should be used with the [`'use client'` directive](https://react.dev/reference/rsc/use-client). + ```ts // Definition function useHydrateAtoms( From f51553dedd43882391152f06fccde3d5fe655cb9 Mon Sep 17 00:00:00 2001 From: Bryan Nguyen Date: Sun, 6 Oct 2024 17:45:13 -0400 Subject: [PATCH 2/2] Update family.mdx grammar (#2762) --- docs/utilities/family.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/utilities/family.mdx b/docs/utilities/family.mdx index 7f92bdf017..b6894d45df 100644 --- a/docs/utilities/family.mdx +++ b/docs/utilities/family.mdx @@ -71,7 +71,7 @@ This is crucial if you use infinite number of params. There are two ways to remove params. - `myFamily.remove(param)` allows you to remove a specific param. -- `myFamily.setShouldRemove(shouldRemove)` is to register `shouldRemove` function which runs immediately **and** when you are to get an atom from a cache. +- `myFamily.setShouldRemove(shouldRemove)` is to register `shouldRemove` function which runs immediately **and** when you are about to get an atom from a cache. - shouldRemove is a function that takes two arguments `createdAt` in milliseconds and `param`, and returns a boolean value. - setting `null` will remove the previously registered function.