-
Notifications
You must be signed in to change notification settings - Fork 26.1k
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
fix(service-worker): assign initializing client's app version, when a… #58131
fix(service-worker): assign initializing client's app version, when a… #58131
Conversation
} else if (this.clientVersionMap.get(event.resultingClientId)! !== hash) { | ||
throw new Error( | ||
`Version mismatch between worker client ${event.resultingClientId} and requesting client ${clientId}`, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if we should throw an error, or fallback to network via return null;
} else if (this.clientVersionMap.get(event.resultingClientId)! !== this.latestHash) { | ||
throw new Error( | ||
`Version mismatch between worker client ${event.resultingClientId} and requesting client ${clientId}`, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if we should throw an error, or fallback to network via return null;
35c5421
to
00f9e46
Compare
00f9e46
to
7a7acb7
Compare
7a7acb7
to
84d11f7
Compare
84d11f7
to
5d1e997
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I think the error is fine. If it's too disruptive, we can change it later.
… request is for worker script When a new version of app is available in a service worker, and a client with old version exists, web workers initialized from a client with old version will now be properly assigned with the same version. Before this change, a web worker was assigned with the newest version. Fixes angular#57971
5d1e997
to
d9b0ad3
Compare
… request is for worker script (#58131) When a new version of app is available in a service worker, and a client with old version exists, web workers initialized from a client with old version will now be properly assigned with the same version. Before this change, a web worker was assigned with the newest version. Fixes #57971 PR Close #58131
This PR was merged into the repository by commit 4546d4f. The changes were merged into the following branches: main, 19.2.x |
… request is for worker script
When a new version of app is available in a service worker, and a client with old version exists, web workers initialized from a client with old version will now be properly assigned with the same version.
Before this change, a web worker was assigned with the newest version.
Fixes #57971
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #57971
What is the new behavior?
When a web worker script request is made to a service worker, it gets assigned the same version as the tab that created it.
Does this PR introduce a breaking change?
No, unless someone was relying on a faulty behavior
Other information