mirror of
https://github.com/mastodon/mastodon.git
synced 2025-10-05 16:42:47 +00:00
Clean up timeout in success effect
Some checks are pending
Chromatic / Run Chromatic (push) Waiting to run
Some checks are pending
Chromatic / Run Chromatic (push) Waiting to run
This commit is contained in:
parent
95a40bef92
commit
231cbd59e6
|
@ -130,10 +130,15 @@ export const RefreshController: React.FC<{
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Hide success message after a short delay
|
// Hide success message after a short delay
|
||||||
if (loadingState === 'success') {
|
if (loadingState === 'success') {
|
||||||
setTimeout(() => {
|
const timeoutId = setTimeout(() => {
|
||||||
setLoadingState('idle');
|
setLoadingState('idle');
|
||||||
}, 3000);
|
}, 3000);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
clearTimeout(timeoutId);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
return () => '';
|
||||||
}, [loadingState]);
|
}, [loadingState]);
|
||||||
|
|
||||||
const handleClick = useCallback(() => {
|
const handleClick = useCallback(() => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user