Skip to content

Increase window location check specificity for Expo 53+ #216

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

Merged
merged 1 commit into from
May 15, 2025

Conversation

erquhart
Copy link
Collaborator

@erquhart erquhart commented May 15, 2025

Fixes #206, #214

Expo runtime introduced a default polyfill to metro runtime, making window.location no longer undefined. This breaks some of our client checks for the RN environment.

This fix makes checks more specific and looks for the actual property we're interacting with to be undefined.

#207 addresses this by adding an explicit prop, which definitely works, but I'd like to avoid adding more props. The library should just handle this for users.

A patch in #206 used navigator.product as a reference, which does appear to be reliably set to ReactNative (source). This is an option for the future if more changes in platforms make checking location object properties a dubious practice.
Not an option, turns out navigator.product is deprecated 🙃

Copy link

vercel bot commented May 15, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
convex-auth-docs ✅ Ready (Inspect) Visit Preview May 15, 2025 1:46pm

@erquhart erquhart changed the title increase window location check specificity for Expo 53+ Increase window location check specificity for Expo 53+ May 15, 2025
@erquhart erquhart requested a review from thomasballinger May 15, 2025 13:56
@thomasballinger
Copy link
Contributor

If there's an expo-endorsed way to detect the environment even better, but let's do this

@erquhart
Copy link
Collaborator Author

The Expo way is the RN way, which is to import Platform from react-native. They don't have a blessed way (that I'm aware of) for cross platform libraries that don't directly use the react native package.

@erquhart erquhart merged commit bd044d9 into main May 15, 2025
5 checks passed
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.

NotSupportedError: Cannot set "location.href"
2 participants