Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SSR check on Node.js v22 #317

Merged
merged 3 commits into from
Jan 31, 2025

Conversation

christianvuerings
Copy link
Contributor

@christianvuerings christianvuerings commented Jan 31, 2025

Background

Node.js v22 added navigator as a global object: https://nodejs.org/docs/latest-v22.x/api/globals.html#navigator_1. So the previous SSR check to see if navigator is available no longer works in Node.js v22.

Fix

Instead of relying on navigator, we should check window instead

Changes

  • Add test to reproduce issue
  • Update GitHub CI to include Node.js v22
  • Change navigator check to window instead

How did we test this?

Node.js v22 before

Screenshot 2025-01-31 at 8 37 27 AM

Node.js v22 after

image

@christianvuerings christianvuerings marked this pull request as ready for review January 31, 2025 16:56
@christianvuerings
Copy link
Contributor Author

@fongandrew Could you take a look at this PR?

At the moment we're using a patched version of react-codemirror2 but would love to use a regular release again.

@fongandrew
Copy link
Collaborator

Seems fine to me.

@fongandrew fongandrew merged commit f301621 into scniro:master Jan 31, 2025
2 checks passed
@fongandrew fongandrew mentioned this pull request Jan 31, 2025
@fongandrew
Copy link
Collaborator

fongandrew commented Jan 31, 2025

Published as v8.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants