🐛BackgroundSyncPlugin doesn't sync when connection is back
Brought to you by:
tomkozak
Originally created by: AntoLC
Library Affected:
workbox-background-sync
Browser & Platform:
Chrome Version 125.0.6422.142 (Official Build) (64-bit)
Issue or Feature Request Description:
It just doesn't sync when the connection is back. When I reload my page, the event sync doesn't seem listened anymore. After a while the sync is triggered but quite some time after we have the connection back (3 or 4mn maybe).
The implementation is quite basic:
registerRoute(
({ url }) => isApiUrl(url.href) && url.href.match(/.*\/documents\/.*\//),
new NetworkOnly({
plugins: [
new ApiPlugin({ type: 'update' }), // to update the cache with new data
new BackgroundSyncPlugin('queue-doc-api'), // save when connection is back
],
}),
'PATCH',
);
```
## Demo
[scrnli_6_17_2024_12-47-05 PM.webm](https://github.com/GoogleChrome/workbox/assets/25994652/2873ca20-f515-43e3-bb75-a5c1a220f0c2)
Originally posted by: Anubarak
Anyone found a solution for this?
A working - but not good way - is to manually trigger replayRequests. But since i access the private _queue property it does not feeld good
Otherwise my requests are indeed queued but will never run