Skip to content

Commit

Permalink
docs: add a warning for setSelf (#2212)
Browse files Browse the repository at this point in the history
  • Loading branch information
dai-shi authored Oct 25, 2023
1 parent 2857b42 commit 247d9b1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/core/atom.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

<CodeSandbox id="hg665r" />
Expand Down
3 changes: 3 additions & 0 deletions src/vanilla/atom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ type SetAtom<Args extends unknown[], Result> = <A extends Args>(
...args: A
) => Result

/**
* setSelf is for internal use only and subject to change without notice.
*/
type Read<Value, SetSelf = never> = (
get: Getter,
options: { readonly signal: AbortSignal; readonly setSelf: SetSelf }
Expand Down

1 comment on commit 247d9b1

@vercel
Copy link

@vercel vercel bot commented on 247d9b1 Oct 25, 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.