mirror of
https://github.com/apricote/Listory.git
synced 2026-01-13 21:21:02 +00:00
fix(frontend): flashing content on useAsync reload
This commit is contained in:
parent
ac0f9ff5d3
commit
e298282f55
1 changed files with 1 additions and 2 deletions
|
|
@ -26,7 +26,6 @@ export const useAsync: UseAsync = <T extends any>(
|
|||
const execute = useCallback(() => {
|
||||
startTransition(() => {
|
||||
setPending(true);
|
||||
setValue(initialValue);
|
||||
setError(null);
|
||||
});
|
||||
|
||||
|
|
@ -34,7 +33,7 @@ export const useAsync: UseAsync = <T extends any>(
|
|||
.then((response) => startTransition(() => setValue(response)))
|
||||
.catch((err) => startTransition(() => setError(err)))
|
||||
.finally(() => startTransition(() => setPending(false)));
|
||||
}, [asyncFunction, initialValue]);
|
||||
}, [asyncFunction]);
|
||||
|
||||
// Call execute if we want to fire it right away.
|
||||
// Otherwise execute can be called later, such as
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue