-
Notifications
You must be signed in to change notification settings - Fork 94
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
Migrate usePromise
from react-use
#1048
Conversation
Thanks for the PR again! Before reviewing this, I want to have a discussion in this repo about checking the Before that, however, I have a couple of other things on my todo-list, so reviewing this might get delayed a bit (other maintainers are free to do it). Thank you for your patience. |
To be honest - I'm not able to imagine worthy usecases of such hook |
Speaking of which, I had a thought the other day: should we start requiring every pull request submitting a new hook to also include a viable use-case in the PR description? There are some pretty weird hooks in react-use that I can't imagine any possible use cases for. This requirement would ensure that there is at least one use-case and would also provide grounds for further discussion. |
I've been planning to revisit PR and issues templates @ArttuOll in case you feel capable of making proposal - feel free to make a PR |
I see the point there. I would also like to request that you go through the list of requested hooks to be moved over from I just wanted to help out and saw the list requesting a bunch of hooks to be moved over with a 'Help Wanted" tag so I started picking some out from the list. It would really some a lot of time if yall just removed the ones you don't want before hand. Then people like me wont write code that nobody needs and it would probably cut down on the amount of hooks you don't want popping up as well. |
Speaking of which, I had a thought the other day: should we start requiring every pull request submitting a new hook to also include a viable use-case in the PR description? There are some pretty weird hooks in react-use that I can't imagine any possible use cases for. This requirement would ensure that there is at least one use-case and would also provide grounds for further discussion.
Agreed. Sorry for the trouble. The list has been filtered already a couple of times. We should do it again. Also, I will redo the PR template today and add a mention that it would be good to ask if a hook is needed before writing it. I will also add this to the contribution guide. |
Absolutely. I'm planning to go through the list again soon when I have time. After all, we are not getting paid to maintain this library. |
What new hook does?
Resolves promise only while the component is mounted.
I ran into a problem with testing. Maybe someone can help me out with it. More or less, I need to test that when unmounted, a promise is not returned. However, not returning a promise will break the test due to timeout. This is the test I was using:
And I tried about a million variations. I AM new to writing tests, so I might be missing something simple. I figured instead of spinning wheels on this I would get a PR up and let yall chime in.
Cheers
Checklist