1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-26 16:25:06 +03:00

Merge pull request #8267 from mabashian/8252-jt-tabs-reload

Reset error/result only after the next request has resolved to prevent render flickering

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot] 2020-09-30 12:24:08 +00:00 committed by GitHub
commit e7a5d4c5d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,18 +38,16 @@ export default function useRequest(makeRequest, initialValue) {
request: useCallback(
async (...args) => {
setIsLoading(true);
if (isMounted.current) {
setResult(initialValue);
setError(null);
}
try {
const response = await makeRequest(...args);
if (isMounted.current) {
setResult(response);
setError(null);
}
} catch (err) {
if (isMounted.current) {
setError(err);
setResult(initialValue);
}
} finally {
if (isMounted.current) {