File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
src/components/common/hooks/useOnline Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -38,15 +38,16 @@ export const useOnline = ({ onOnline = noop }: { onOnline?: () => void }) => {
38
38
39
39
timeoutRef . current = setTimeout ( checkConnectivity , INTERNET_CONNECTIVITY_INTERVAL )
40
40
} catch ( error ) {
41
+ if ( getIsRequestAborted ( error ) ) return
42
+ const fallbackController = new AbortController ( )
43
+ abortControllerRef . current = fallbackController
41
44
try {
42
- await getFallbackInternetConnectivity ( abortControllerRef . current )
45
+ await getFallbackInternetConnectivity ( fallbackController )
43
46
onConnectivitySuccess ( )
44
47
} catch {
45
48
setOnline ( false )
46
49
} finally {
47
- if ( ! getIsRequestAborted ( error ) ) {
48
- timeoutRef . current = setTimeout ( checkConnectivity , INTERNET_CONNECTIVITY_INTERVAL )
49
- }
50
+ timeoutRef . current = setTimeout ( checkConnectivity , INTERNET_CONNECTIVITY_INTERVAL )
50
51
}
51
52
}
52
53
}
You can’t perform that action at this time.
0 commit comments