Skip to content

fix(service-worker): assign initializing client's app version, when a…#58131

Closed
rozpuszczalny wants to merge 1 commit intoangular:mainfrom
rozpuszczalny:bugfix/57971-web-worker-version-mismatch
Closed

fix(service-worker): assign initializing client's app version, when a…#58131
rozpuszczalny wants to merge 1 commit intoangular:mainfrom
rozpuszczalny:bugfix/57971-web-worker-version-mismatch

Conversation

@rozpuszczalny
Copy link
Copy Markdown
Contributor

@rozpuszczalny rozpuszczalny commented Oct 9, 2024

… 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?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

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

  • Yes
  • No

Other information

@pullapprove pullapprove bot requested a review from alxhub October 9, 2024 08:12
@angular-robot angular-robot bot added the area: service-worker Issues related to the @angular/service-worker package label Oct 9, 2024
@ngbot ngbot bot added this to the Backlog milestone Oct 9, 2024
Copy link
Copy Markdown
Contributor Author

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;

Copy link
Copy Markdown
Contributor Author

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;

@rozpuszczalny rozpuszczalny force-pushed the bugfix/57971-web-worker-version-mismatch branch from 35c5421 to 00f9e46 Compare October 25, 2024 06:35
@rozpuszczalny rozpuszczalny force-pushed the bugfix/57971-web-worker-version-mismatch branch from 00f9e46 to 7a7acb7 Compare November 5, 2024 12:15
@rozpuszczalny rozpuszczalny force-pushed the bugfix/57971-web-worker-version-mismatch branch from 7a7acb7 to 84d11f7 Compare November 15, 2024 06:26
@rozpuszczalny rozpuszczalny force-pushed the bugfix/57971-web-worker-version-mismatch branch from 84d11f7 to 5d1e997 Compare December 2, 2024 10:00
Copy link
Copy Markdown
Contributor

@thePunderWoman thePunderWoman left a 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.

@thePunderWoman thePunderWoman removed the request for review from alxhub April 2, 2025 13:45
@thePunderWoman thePunderWoman added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Apr 2, 2025
… 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
@thePunderWoman thePunderWoman force-pushed the bugfix/57971-web-worker-version-mismatch branch from 5d1e997 to d9b0ad3 Compare April 2, 2025 14:10
thePunderWoman pushed a commit that referenced this pull request Apr 2, 2025
… 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
@thePunderWoman
Copy link
Copy Markdown
Contributor

This PR was merged into the repository by commit 4546d4f.

The changes were merged into the following branches: main, 19.2.x

@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators May 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: service-worker Issues related to the @angular/service-worker package target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spawning Web Worker from previous AppVersion results in network fallback

2 participants