File tree Expand file tree Collapse file tree 1 file changed +13
-21
lines changed Expand file tree Collapse file tree 1 file changed +13
-21
lines changed Original file line number Diff line number Diff line change @@ -328,40 +328,32 @@ export class Component {
328
328
clearInterval ( this . poll . timer ) ;
329
329
}
330
330
} else {
331
- // tab gets focus -> call poll method once and
332
- // start polling at intervals
333
- if ( this . isPollEnabled ( ) ) {
334
- this . callMethod (
335
- this . poll . method ,
336
- this . poll . partials ,
337
- this . handlePollError
338
- ) ;
339
- }
340
- this . startPolling ( ) ;
331
+ // Call the poll method once the tab is visible again
332
+ this . startPolling ( true ) ;
341
333
}
342
334
} ,
343
335
false
344
336
) ;
345
337
346
338
this . poll . partials = rootElement . partials ;
347
339
348
- if ( this . isPollEnabled ( ) ) {
349
- // Call the method once before the timer starts
350
- this . callMethod (
351
- this . poll . method ,
352
- this . poll . partials ,
353
- this . handlePollError
354
- ) ;
355
- }
356
-
357
- this . startPolling ( ) ;
340
+ // Call the method once before the timer starts
341
+ this . startPolling ( true ) ;
358
342
}
359
343
}
360
344
361
345
/**
362
346
* Starts polling and handles stopping the polling if there is an error.
363
347
*/
364
- startPolling ( ) {
348
+ startPolling ( fireImmediately ) {
349
+ if ( fireImmediately && this . isPollEnabled ( ) ) {
350
+ this . callMethod (
351
+ this . poll . method ,
352
+ this . poll . partials ,
353
+ this . handlePollError
354
+ ) ;
355
+ }
356
+
365
357
this . poll . timer = setInterval ( ( ) => {
366
358
if ( this . isPollEnabled ( ) ) {
367
359
this . callMethod (
You can’t perform that action at this time.
0 commit comments