-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
feat(useAsyncState): add executeImmediate with the same type as the promise fn #4716
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
base: main
Are you sure you want to change the base?
Conversation
I see that for some people the first parameter of the |
im not sure about this, given you should already be able to achieve it by i understand it is a convenience function though, so not going to block this if other maintainers approve code looks good 👍 though i'd probably call it |
@43081j What do you think of a shorter name? like For me the best would be const { run: fnName, isReady, isLoading, error } = useAsyncState(originalFn), {})
// vs (longest, divided into several lines)
const {
executeImmediate: fnName,
isReady,
isLoading,
error
} = useAsyncState(originalFn), {}) |
I'm going to change it as you suggest, having 2 different names only increases the confusion. |
6eba598
to
e77380e
Compare
…mise fn Signed-off-by: davidglezz <davidgg666@gmail.com>
Signed-off-by: davidglezz <davidgg666@gmail.com>
…Options Signed-off-by: davidglezz <davidgg666@gmail.com>
e77380e
to
dccdf03
Compare
Before submitting the PR, please make sure you do the following
fixes #123
).Description
Implements #4580
Closes #4580
This PR adds a
executeNow
method that has the same input function arguments.Also adds a example of using
execute
vsexecuteNow
And improves the
delay
config description.Additional context