sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

A hash in the URL causes a loop when refreshing the page if the Service Worker adds `?sw=bypass`

Open michaelcoxon opened this issue 5 years ago • 12 comments

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

  1. Change language to English Australia
  2. Open SharePoint to a page that is using the service worker/SPFx stuff
  3. Add #/ to the end of the URL
  4. Refresh the page a few times to get the sw=bypass to happen.

I can provide more info in a Teams meeting if required.

Expected behavior

The CurrentCulture and the CurrentUICulture should not be different.

michaelcoxon avatar Sep 29 '21 02:09 michaelcoxon

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

ghost avatar Sep 29 '21 02:09 ghost

I can confirm the changing the region from Aus to US fixes the problem for now.

LeonPienaar avatar Sep 30 '21 07:09 LeonPienaar

Thanks for letting us know. We've found the issue and made a fix. 100% rollout should be within the next couple of weeks.

patmill avatar Sep 30 '21 15:09 patmill

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?

christianteh avatar Oct 13 '21 00:10 christianteh

@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.

shaipetel avatar Oct 13 '21 13:10 shaipetel

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).

patmill avatar Oct 13 '21 16:10 patmill

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

christianteh avatar Oct 13 '21 21:10 christianteh

@patmill Thanks! we will confirm shortly if this solved it for us as well.

shaipetel avatar Oct 13 '21 22:10 shaipetel

@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!

shaipetel avatar Oct 13 '21 22:10 shaipetel

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.

patmill avatar Oct 13 '21 23:10 patmill

Sorry - missed closing this one. The fix has been rolled out fully for a week or two now.

patmill avatar Nov 16 '21 03:11 patmill

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

ghost avatar Nov 23 '21 06:11 ghost