async-library / react-async

🍾 Flexible promise-based React data loader

Home Page:https://docs.react-async.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for async iterators

RangerMauve opened this issue · comments

This library has been super helpful for loading data needed for various views in an app.

However, we've run into issues when it came to integrating asynchronous updates with everything.

It'd be cool if promiseFN could be extended with generatorFN which would be an async generator that would yield new data for the component to render and have react-async manage spinning it up and tearing it down.

Does this sound like it should belong in this library, or would it be better to spin out something new for this use case?

Hey, this is not currently supported by React Async, but it's part of the future plans. In fact there's a working implementation of subscriptions in an unreleased future version of the library. However, work on this is currently stalled, mostly due to uncertainty around Suspense and the appearance of React Query and SWR. Also React Async is currently implemented in TypeScript while this future version is in vanilla JS, and I'm not a TypeScript expert at all (I didn't do the migration to TS myself). So if you'd like to pick up the effort to get it into a shippable state (it's mostly feature complete already), I'd really really appreciate it. If not then this is probably going to take a while for me to get back to.

Thanks for the response! I actually ended up migrating to use-async-generator since it ended up fulfilling all my use cases with less overall code. 😅

Fair enough. Enjoy.