-
Notifications
You must be signed in to change notification settings - Fork 578
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
RJS-2732: Support updating the App
's base URL via experimental export
#6518
Conversation
realm/experimental
App
's base URL via experimental export
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.
Nice! Might be worth adding a smoke test that updating the base url to a valid url also works. We could try and use realm.mongodb.com
since that domain should still work.
Just reviving the old draft implementation then I'll be modifying the test and adding some more 🙂 |
it.skip("updates the URL", async function (this: AppContext) { | ||
// TODO | ||
}); |
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.
Will add this using a fetch mock.
integration-tests/environments/react-native-test-app/metro.config.js
Outdated
Show resolved
Hide resolved
@@ -3,7 3,7 @@ | |||
"composite": true, | |||
"target": "es2022", | |||
"module": "es2022", | |||
"moduleResolution": "node", | |||
"moduleResolution": "Bundler", |
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.
Did you check this works with npm test --workspace @realm/integration-tests
(where we use raw Mocha and tsx
to transpile TypeScript)?
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.
Works ✅
|
||
// This file is needed as a workaround for Metro unexpectedly failing | ||
// to use the entry point defined in the package.json `exports` field, | ||
// despite enabling `unstable_enablePackageExports`. |
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.
Well - even if this wasn't a problem, we would probably need this file anyway, to workaround the fact that unstable_enablePackageExports
is disabled by default 🤔
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.
Also ... I know for a fact that the Metro team would be very grateful if someone would set up some tests of the metro resolver (most likely copying in tests from other packages / tools). This would make a good test case if the pattern isn't already covered by one of those other tests.
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've updated the comment to incorporate being disabled by default. Feel free to suggest any additional changes you think would be relevant for this file 👍
I'd be glad to look over some of the Metro tests and see what could be added. At first glance, it does seem like their tests are covering subpath exports.
@@ -1107,7 1107,7 @@ PODS: | |||
- React-Core | |||
- React-jsi | |||
- ReactTestApp-Resources (1.0.0-dev) | |||
- RealmJS (12.7.0-rc.0): | |||
- RealmJS (12.7.1): |
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 wonder why this was not already on main
🤔
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.
Probably just didn't get committed 🤷♀️
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.
Nice work!
Co-authored-by: Kræn Hansen <[email protected]>
@kneth, for the final review there are only minor changes to look at:
Still missing:
|
What, How & Why?
Experimental exports/imports
experimental
directory has been added (packages/realm/src/experimental
), intended for exporting various experimental features.Base URL
"realm/experimental/base-url"
will extend theApp
with the instance membersApp.baseUrl
andApp.updateBaseUrl()
, allowing the user to retrieve and update the base URL.TSConfig / Choosing module resolution
tsconfig.json
:Example Usage
This closes #6486
☑️ ToDos