Skip to content

Commit

Permalink
Fix test errors (elastic#115183)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
sabarasaba and kibanamachine committed Oct 20, 2021
1 parent 04e0d67 commit 38b7d07
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/plugins/es_ui_shared/public/request/use_request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,13 @@ export const useRequest = <D = any, E = Error>(
: serializedResponseData;
setData(responseData);
}
// Setting isLoading to false also acts as a signal for scheduling the next poll request.
setIsLoading(false);
// There can be situations in which a component that consumes this hook gets unmounted when
// the request returns an error. So before changing the isLoading state, check if the component
// is still mounted.
if (isMounted.current === true) {
// Setting isLoading to false also acts as a signal for scheduling the next poll request.
setIsLoading(false);
}
},
[requestBody, httpClient, deserializer, clearPollInterval]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const Step: React.FunctionComponent<StepProgressStep & { idx: number }> = ({
<Fragment>
<div className="upgStepProgress__step">
<StepStatus status={status} idx={idx} />
<p className={titleClassName}>{title}</p>
<div className={titleClassName}>{title}</div>
</div>
{children && <div className="upgStepProgress__content">{children}</div>}
</Fragment>
Expand Down

0 comments on commit 38b7d07

Please sign in to comment.