A hash in the URL causes a loop when refreshing the page if the Service Worker adds `?sw=bypass`
Target SharePoint environment
SharePoint Online
What SharePoint development model, framework, SDK or API is this about?
not applicable
Developer environment
No response
What browser(s) / client(s) have you tested
- [ ] 💥 Internet Explorer
- [X] 💥 Microsoft Edge
- [ ] 💥 Google Chrome
- [ ] 💥 FireFox
- [ ] 💥 Safari
- [ ] mobile (iOS/iPadOS)
- [ ] mobile (Android)
- [ ] not applicable
- [ ] other (enter in the "Additional environment details" area below)
Additional environment details
- Version 94.0.992.31 (Official build) (64-bit)
- 1.12.1
- Language English Australia
Describe the bug / error
The service worker throws an exception when the CurrentCulture and the CurrentUICulture are different. This in turn causes the page to reload with sw=bypass. It then triggers the worker to remove the sw=bypass on reload, but if the URL has only 1 query parameter AND a hash it throws the same exception and gets stuck in a loop.
Steps to reproduce
- Change language to English Australia
- Open SharePoint to a page that is using the service worker/SPFx stuff
- Add
#/to the end of the URL - Refresh the page a few times to get the
sw=bypassto happen.
I can provide more info in a Teams meeting if required.
Expected behavior
The CurrentCulture and the CurrentUICulture should not be different.
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
I can confirm the changing the region from Aus to US fixes the problem for now.
Thanks for letting us know. We've found the issue and made a fix. 100% rollout should be within the next couple of weeks.
can confirm the loop does not happen anymore, however it introduce new issue for app that is using hashrouter as it removes hash url. Is this going to be expected behaviour moving forward?
@patmill this is actually now a much bigger issue! The service worker seems to remove hash from the URL. Some of our applications rely on the hash parameters - I don't know how your team thought that removing the hash from the URL is an acceptable solution?
This is now affecting many of our customers in production.
Thanks for the information @shaipetel . Talking to the team, there were a few issues that collided here. We've turned off the behavior to stripping off the hash for now, and will reintroduce it (but only remove the specific hash value that is added by the system).
seems to be okay now , i can see sw=bypass persist in the url, but at least it's not stripping out hash parameters anymore
@patmill Thanks! we will confirm shortly if this solved it for us as well.
@patmill i confirm this fixes it for us too.
But it adds the sw=bypass param to the page. is that by design/to remain or just a temporary fix?
we actually did the same thing for now lol
thanks for the quick response!
Yes, this is temporary. A couple of fixes went in to address some issues, and wound up not playing nicely together, so we've disabled them for now, and an updated solution should be starting to go out next week, with full rollout the next week.
Sorry - missed closing this one. The fix has been rolled out fully for a week or two now.
Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues