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:
commit
e7a5d4c5d8
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user