react-router
react-router copied to clipboard
Fix crash on certain versions of Tizen and Samsung Internet
Issue description
A friend was having issues with Jellyfin on his Samsung Smart TV. Running the program, the following stack trace displayed:
It reads out: TypeError: Failed to construct 'Headers': No matching constructor signature.
Tracking this down, it is due to some react-router code. Turns out, this is due to a bug in Samsung's JavaScript implementation. new Headers(undefined) should be a valid constructor, but running this on Samsung, this errors. I suggested updating the browser, but this was not possible, as the version was locked.
Fix
Thus, like in other projects I've seen, I've implemented the fix of running the constructor with no parameters (new Headers()) instead of undefined or null (~~new Headers(undefined)~~).
This is inspired from the following work:
- https://github.com/GoogleChrome/workbox/issues/1461 with the fix of https://github.com/GoogleChrome/workbox/pull/1463
- https://github.com/connectrpc/connect-es/issues/231 with the fix of https://github.com/connectrpc/connect-es/pull/232
- https://github.com/whatwg/fetch/issues/185
- https://github.com/unjs/ofetch/pull/235
These changes increase compatibility, making it possible to run react-router on older browser implementations, and introduce no breaking changes.
After building using this fork of React Router, the program was no longer crashing on my friend's Tizen system.
🦋 Changeset detected
Latest commit: 8d9ec2acb70e75378172796d114ade086217ae4a
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 5 packages
| Name | Type |
|---|---|
| @remix-run/router | Patch |
| react-router | Patch |
| react-router-dom | Patch |
| react-router-dom-v5-compat | Patch |
| react-router-native | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
@tacheometry This issue is getting more attention since the jellyfin 10.9.x release. Is there any way you can fix the CI issue, repush and notify the maintainer ? Best regards
Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳
Should be good to go @CLEMENTINATOR
Regarding getting more attention on this, engagement from affected users might help
In that case I'll just mention that I am affected by this as well.
webOS 4 (at least the emulator) has the same bug.