Skip to content

Expose promise as prop #79

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

Closed
ghengeveld opened this issue Aug 11, 2019 · 1 comment
Closed

Expose promise as prop #79

ghengeveld opened this issue Aug 11, 2019 · 1 comment
Labels
feature New feature requests good first issue Good for newcomers

Comments

@ghengeveld
Copy link
Member

Because run does not reject on error, we should expose a new promise property from useAsync and in the render props of <Async>, which rejects or resolves along with the internal promise. Probably just create a new Promise(...) along with new window.AbortController() and keep it as a ref. It can be resolved/rejected from handleResolve and handleReject.

@ghengeveld ghengeveld added enhancement Enhancement to existing feature good first issue Good for newcomers labels Aug 12, 2019
@ghengeveld ghengeveld added feature New feature requests and removed enhancement Enhancement to existing feature labels Aug 13, 2019
ghengeveld added a commit that referenced this issue Aug 22, 2019
…83)

* Expose wrapper promise as a prop so it can be chained on.

* Let run return void.

* Update propTypes.
@ghengeveld
Copy link
Member Author

Released in v8.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature requests good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant