-
Notifications
You must be signed in to change notification settings - Fork 821
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
Multiple controlling events #2817
Comments
Thanks for catching that, @joshkel. My supposition is that workbox/packages/workbox-window/src/Workbox.ts Lines 191 to 192 in ef225a9
was written with I think you're already familiar with our codebase, so if you want to take on removing that |
Dispatches the `controlling` event every time the documentation specifies that it should.
* Fire controlling event more than once (#2817) Dispatches the `controlling` event every time the documentation specifies that it should. * Test tweak * One more fix Co-authored-by: Jeff Posnick <[email protected]>
The fix is now deployed in a pre-release of Workbox v6.2.0: https://github.com/GoogleChrome/workbox/releases/tag/v6.2.0-alpha.0 |
Library Affected: workbox-window
Browser & Platform: Tested on Chrome 89.0.4389.114 for Mac
Issue or Feature Request Description:
I'm having trouble getting the Workbox class's
controlling
event to work like I expect - or maybe I'm misunderstanding how it's expected to work.Scenario: I want my page to reload on update, like in the recipe:
However, unlike the recipe, I want my page to reload even if the update was confirmed in the UI in another browser tab. So I set up this event handler at application start, instead of in response to a
waiting
event. (That was working even prior to #2786 and Workbox 6.1.5, so I may be misunderstanding #2786.)Then I noticed that my page would reload when it was first loaded (because the newly installed service worker takes control via
clientsClaim
). That seems unnecessary, so I added a check for that:However, I then discovered that the
controlling
event can only fire once: a newly loaded page gets thecontrolling
event for the initial load, so it then no longer gets events notifying of future updates.This seems like a bug, but I could easily be misunderstanding something. Is this the desired behavior?
The text was updated successfully, but these errors were encountered: