Skip to content

Commit

Permalink
[Infra] Reset error state in useHTTPRequest hook (elastic#166752)
Browse files Browse the repository at this point in the history
Closes elastic#166748 
## Summary

This PR fixes an issue with the error state - when there is a successful
request after a failed request the error state was still visible.

### Before

https://github.com/elastic/kibana/assets/14139027/0cb15cab-dc7c-48ad-b080-179f0444284d

### After


https://github.com/elastic/kibana/assets/14139027/e765b5e9-d213-45da-968f-257955b1f4b0
  • Loading branch information
jennypavlova authored and delanni committed Sep 21, 2023
1 parent 7a6eb23 commit 3823b8f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions x-pack/plugins/infra/public/hooks/use_http_request.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export function useHTTPRequest<Response>(
onResolve: (resp) => {
try {
setResponse(decode(resp)); // Catch decoding errors
setError(null);
} catch (e) {
onError(e);
}
Expand Down

0 comments on commit 3823b8f

Please sign in to comment.