Skip to content

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Nov 23, 2021

Backport of #38340 to release/6.0

/cc @BrennanConroy

Use window.document for React-Native

Description

When using React-Native on an Android/iOS device you will see an error when trying to connect: ReferenceError: Can't find variable: document'. This is because our check for using the document variable didn't properly handle environments like React-Native where a window exists but document doesn't.

Fixes #38286

Customer Impact

The SignalR TypeScript library is not usable when upgrading to 6.0 when using React-Native.

I did come up with a workaround that is non-obvious to unblock customers:

if (!globalThis.document) {
  (globalThis.document as any) = undefined;
}

Regression?

  • Yes
  • No

Regression from 5.0 to 6.0

Risk

  • High
  • Medium
  • Low

Scope of change is small. Made platform checks more robust to avoid unexpected failures when using different frameworks.

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

@ghost ghost added the area-signalr Includes: SignalR clients and servers label Nov 23, 2021
@ghost ghost added this to the 6.0.x milestone Nov 23, 2021
@ghost
Copy link

ghost commented Nov 23, 2021

Hi @github-actions[bot]. If this is not a tell-mode PR, please make sure to follow the instructions laid out in the servicing process document.
Otherwise, please add tell-mode label.

@BrennanConroy BrennanConroy added the Servicing-consider Shiproom approval is required for the issue label Nov 24, 2021
@ghost
Copy link

ghost commented Nov 24, 2021

Hi @github-actions[bot]. Please make sure you've updated the PR description to use the Shiproom Template. Also, make sure this PR is not marked as a draft and is ready-to-merge.

To learn more about how to prepare a servicing PR click here.

@Pilchie Pilchie modified the milestones: 6.0.x, 6.0.2 Dec 2, 2021
@Pilchie Pilchie added Servicing-approved Shiproom has approved the issue and removed Servicing-consider Shiproom approval is required for the issue labels Dec 2, 2021
@wtgodbe wtgodbe merged commit 57c684a into release/6.0 Dec 7, 2021
@wtgodbe wtgodbe deleted the backport/pr-38340-to-release/6.0 branch December 7, 2021 22:12
@ghost ghost modified the milestones: 6.0.2, 6.0.1 Dec 7, 2021
@dougbu dougbu modified the milestones: 6.0.1, 6.0.2 Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-signalr Includes: SignalR clients and servers Servicing-approved Shiproom has approved the issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants