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(async): improve the reatomAsync's section in the async package #956

Open
wants to merge 1 commit into
base: v3
Choose a base branch
from
Open
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: 3 additions & 3 deletions docs/src/content/docs/package/async.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ You could utilize extra features by piping additional operators: [withDataAtom](

## reatomAsync

`reatomAsync` accepts effect function which returns a promise (it could be just `async` function) and call it in effects queue. `ctx` already includes `controller` which is a native [AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController). The most cool feature of this package and game changer for your DX and your code reliability is automatic linking of nested abort controllers. It means that if you have concurrent ([abortable](#withabort)) process, like on input search with a few serial requests, when a new search starts, previous search and all generated effects cancel automatically.
`reatomAsync` accepts an effect function that returns a promise (it can simply be an `async` function) and queues it in the effects pipeline.The `ctx` object already includes a `controller` which is a native [AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController). The standout feature of this package—a true game changer for developer experience (DX) and code reliabilityis its automatic handling of nested abort controllers. This means that for concurrent([abortable](#withabort)) processes, like an input search that triggers multiple sequential requests, starting a new search will automatically cancel the previous one and all associated effects.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
`reatomAsync` accepts an effect function that returns a promise (it can simply be an `async` function) and queues it in the effects pipeline.The `ctx` object already includes a `controller` which is a native [AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController). The standout feature of this package—a true game changer for developer experience (DX) and code reliability—is its automatic handling of nested abort controllers. This means that for concurrent([abortable](#withabort)) processes, like an input search that triggers multiple sequential requests, starting a new search will automatically cancel the previous one and all associated effects.
`reatomAsync` accepts an effect function that returns a promise (it can simply be an `async` function) and queues it in the effects queue. The `ctx` object already includes a `controller` which is a native [AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController). The standout feature of this package—a true game changer for developer experience (DX) and code reliability—is its automatic handling of nested abort controllers. This means that for concurrent ([abortable](#withabort)) processes, like an input search that triggers multiple sequential requests, starting a new search will automatically cancel the previous one and all associated effects.

It's not a pipeline, it's the actual "near effects queue"


Base `reatomAsync` weight is just [1.2KB](https://bundlejs.com/?q=%40reatom%2Fasync&treeshake=%5B%7B+reatomAsync+%7D%5D) and the whole package is only [2.6KB](https://bundlejs.com/?q=%40reatom%2Fasync)!
The core `reatomAsync` package is lightweight,at just [1.2KB](https://bundlejs.com/?q=%40reatom%2Fasync&treeshake=%5B%7B+reatomAsync+%7D%5D), while the entire package is only [2.6KB](https://bundlejs.com/?q=%40reatom%2Fasync)!
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
The core `reatomAsync` package is lightweight,at just [1.2KB](https://bundlejs.com/?q=%40reatom%2Fasync&treeshake=%5B%7B+reatomAsync+%7D%5D), while the entire package is only [2.6KB](https://bundlejs.com/?q=%40reatom%2Fasync)!
The core `reatomAsync` package is lightweight, at just [1.2KB](https://bundlejs.com/?q=%40reatom%2Fasync&treeshake=%5B%7B+reatomAsync+%7D%5D), while the entire package is only [2.6KB](https://bundlejs.com/?q=%40reatom%2Fasync)!


As the main point of this package is general management of async functions, there is no built in solution for data requests in the web or other environment. Fill free to use any existing library, like tiny [redaxios](https://www.npmjs.com/package/redaxios) or feature-rich [axios](https://www.npmjs.com/package/axios).
Since the package is designed for general asynchronous function management, it doesn’t include a built-in solution for data requests in specific environments, such as the web.You’re free to integrate any library you prefer, like the minimalist [redaxios](https://www.npmjs.com/package/redaxios) or the feature-rich [axios](https://www.npmjs.com/package/axios).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Since the package is designed for general asynchronous function management, it doesn’t include a built-in solution for data requests in specific environments, such as the web.You’re free to integrate any library you prefer, like the minimalist [redaxios](https://www.npmjs.com/package/redaxios) or the feature-rich [axios](https://www.npmjs.com/package/axios).
Since the package is designed for general asynchronous function management, it doesn’t include a built-in solution for data requests in specific environments, such as the web. You’re free to integrate any library you prefer, like the minimalist [redaxios](https://www.npmjs.com/package/redaxios) or the feature-rich [axios](https://www.npmjs.com/package/axios).


### Default request helper

Expand Down