8000 Abstract global usage and export patch for window by henrytao-me · Pull Request #556 · Shopify/remote-dom · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Closed
wants to merge 5 commits into from

Conversation

henrytao-me
Copy link
Member

This comment has been minimized.

@henrytao-me henrytao-me force-pushed the app-ui/issues/2145/remote-dom-patch branch from a4ca4e8 to 0312e68 Compare March 24, 2025 20:44
@henrytao-me
Copy link
Member Author

/snapit

@shopify-github-actions-access
Copy link
Contributor

🫰✨ Thanks @henrytao-me! Your snapshots have been published to npm.

Test the snapshots by updating your package.json with the newly published versions:

"@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"

@henrytao-me henrytao-me force-pushed the app-ui/issues/2145/remote-dom-patch branch from 9c369a5 to 3996cd1 Compare March 25, 2025 16:10
@henrytao-me
Copy link
Member Author

/snapit

@shopify-github-actions-access
Copy link
Contributor

🫰✨ Thanks @henrytao-me! Your snapshots have been published to npm.

Test the snapshots by updating your package.json with the newly published versions:

"@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
Copy link
Member

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:'},
Copy link
Member

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: ''},
Copy link
Member

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);
Copy link
Member

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

@henrytao-me
Copy link
Member Author

Close as not needed

@henrytao-me henrytao-me deleted the app-ui/issues/2145/remote-dom-patch branch March 25, 2025 17:14
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
0