-
Notifications
You must be signed in to change notification settings - Fork 63
Abstract global usage and export patch for window #556
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
Conversation
This comment has been minimized.
This comment has been minimized.
a4ca4e8
to
0312e68
Compare
/snapit |
🫰✨ Thanks @henrytao-me! Your snapshots have been published to npm. Test the snapshots by updating your "@remote-dom/compat": "0.0.0-snapshot-20250324204457",
"@remote-dom/core": "0.0.0-snapshot-20250324204457",
"@remote-dom/polyfill": "0.0.0-snapshot-20250324204457",
"@remote-dom/react": "0.0.0-snapshot-20250324204457" |
9c369a5
to
3996cd1
Compare
/snapit |
🫰✨ Thanks @henrytao-me! Your snapshots have been published to npm. Test the snapshots by updating your "@remote-dom/compat": "0.0.0-snapshot-20250325161059",
"@remote-dom/core": "0.0.0-snapshot-20250325161059",
"@remote-dom/polyfill": "0.0.0-snapshot-20250325161059",
"@remote-dom/react": "0.0.0-snapshot-20250325161059" |
@@ -0,0 +1,9 @@ | |||
--- | |||
'example-kitchen-sink': patch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we only need to patch @remote-dom/react
// We copy their implementation from the existing global scope when it exists, and | ||
// provide a minimal working implementation otherwise. | ||
Object.defineProperty(window, 'location', { | ||
value: location ?? {protocol: 'https:'}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be globalThis.location
?
}); | ||
|
||
Object.defineProperty(window, 'navigator', { | ||
value: navigator ?? {userAgent: ''}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question here
} | ||
|
||
export {}; | ||
patch(window); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should keep the old implementation unchanged for the polyfill to be safe. We only need to patch location
and navigator
for window
Close as not needed |
Resolves https://github.com/Shopify/temp-project-mover-Archetypically-20250513094629/issues/525