Skip to content

Commit 731f2bc

Browse files
committed
set isPolling to false after fetch
1 parent 3a72fc5 commit 731f2bc

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/lazy-components/cimo/index.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ const CimoDownloadNotice = props => {
5252
nonce: cimo.nonce,
5353
} ),
5454
credentials: 'same-origin',
55-
} ).then( res => res.json() ).then( res => {
55+
} ).then( res => res.json() ).then( res => {
56+
isPolling = false
57+
5658
if ( ! res.success ) {
5759
setData( { status: 'error', action: '' } )
5860

@@ -85,17 +87,18 @@ const CimoDownloadNotice = props => {
8587
( action === 'install' && ( _data.status === 'installed' || _data.status === 'activated' ) ) ||
8688
( action === 'activate' && _data.status === 'activated' )
8789
) {
88-
isPolling = false
8990
return
9091
}
9192

9293
setTimeout( () => {
9394
pollStatus( action )
9495
}, 3000 * pollCountRef.current )
95-
} ).catch( e => {
96+
} ).catch( e => {
9697
// eslint-disable-next-line no-console
9798
console.error( e.message )
98-
} )
99+
} ).finally( () => {
100+
isPolling = false
101+
} )
99102
}
100103

101104
useEffect( () => {

0 commit comments

Comments
 (0)