react-router icon indicating copy to clipboard operation
react-router copied to clipboard

Fix crash on certain versions of Tizen and Samsung Internet

Open tacheometry opened this issue 1 year ago • 7 comments

Issue description

A friend was having issues with Jellyfin on his Samsung Smart TV. Running the program, the following stack trace displayed:

TypeError: Failed to construct 'Headers': No matching constructor signature.

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.

tacheometry avatar Dec 27 '23 23:12 tacheometry

🦋 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

changeset-bot[bot] avatar Dec 27 '23 23:12 changeset-bot[bot]

@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

CLEMENTINATOR avatar May 18 '24 05:05 CLEMENTINATOR

Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳

remix-cla-bot[bot] avatar May 18 '24 10:05 remix-cla-bot[bot]

Should be good to go @CLEMENTINATOR

tacheometry avatar May 18 '24 11:05 tacheometry

Regarding getting more attention on this, engagement from affected users might help

tacheometry avatar May 18 '24 11:05 tacheometry

In that case I'll just mention that I am affected by this as well.

newo-2001 avatar May 18 '24 14:05 newo-2001

webOS 4 (at least the emulator) has the same bug.

dmitrylyzo avatar May 18 '24 22:05 dmitrylyzo