Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛BackgroundSyncPlugin doesn't sync when connection is back #3335

Open
AntoLC opened this issue Jun 17, 2024 · 0 comments
Open

🐛BackgroundSyncPlugin doesn't sync when connection is back #3335

AntoLC opened this issue Jun 17, 2024 · 0 comments

Comments

@AntoLC
Copy link

AntoLC commented Jun 17, 2024

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant