From 247d9b1a0d6b3ffd018df5a82e4ab87bdea1c07f Mon Sep 17 00:00:00 2001 From: Daishi Kato Date: Thu, 26 Oct 2023 00:03:23 +0900 Subject: [PATCH] docs: add a warning for setSelf (#2212) --- docs/core/atom.mdx | 6 ++++++ src/vanilla/atom.ts | 3 +++ 2 files changed, 9 insertions(+) diff --git a/docs/core/atom.mdx b/docs/core/atom.mdx index 48d9686341..336ef2897d 100644 --- a/docs/core/atom.mdx +++ b/docs/core/atom.mdx @@ -180,6 +180,12 @@ For `fetch` use case, we can simply pass `signal`. See the below example for `fetch` usage. +#### `options.setSelf` + +It's a special function to invoke the write function of the self atom. + +⚠️ It's provided primarily for internal usage and third-party library authors. Read the source code carefully to understand the behavior. Check release notes for any breaking/non-breaking changes. + ## codesandbox diff --git a/src/vanilla/atom.ts b/src/vanilla/atom.ts index d7fba78de9..0c8181155b 100644 --- a/src/vanilla/atom.ts +++ b/src/vanilla/atom.ts @@ -9,6 +9,9 @@ type SetAtom = ( ...args: A ) => Result +/** + * setSelf is for internal use only and subject to change without notice. + */ type Read = ( get: Getter, options: { readonly signal: AbortSignal; readonly setSelf: SetSelf }