Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add a warning for setSelf #2212

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading