-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Rename useRequest's sendRequest return function to resendRequest and remove return value #76795
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
Rename useRequest's sendRequest return function to resendRequest and remove return value #76795
Conversation
|
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
|
Pinging @elastic/ingest-management (Team:Ingest Management) |
sebelga
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for putting this together @cjcenizal
I would have preferred to simply have a new handler in the lib for that without the need of making any other changes. Would that be possible?
const resendRequest = useCallback(async () => {
await sendRequest();
}, [sendRequest]);I like the sendRequest internal naming as it is as it makes things simpler.
EDIT: actually, as you removed the return statement, it could just be
return {
isInitialRequest,
isLoading,
error,
data,
resendRequest: sendRequest, // Gives the user the ability to manually request data
};
jen-huang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the renaming, Ingest Manager changes LGTM
|
@sebelga Can we keep it as-is? I changed the name for a couple reasons which I think are an improvement:
|
|
@elasticmachine merge upstream |
sebelga
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM! Thanks for making these changes 👍
💚 Build SucceededBuild metricsasync chunks size
page load bundle size
History
To update your PR or re-run it, just comment with: |
Per #72947 (comment), this change requires consumers of
useRequestto depend on the hook's return values instead of the values resolved by thesendRequestfunction. It also renames this function toresendRequestto disambiguate it with the standalonesendRequestmodule.