-
Notifications
You must be signed in to change notification settings - Fork 42
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
RSTUDIO-540: Fix connect to server #1666
Changes from all commits
f6df818
b6842bd
fe60aa5
03fb710
e140aeb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,8 @@ import { | |
|
||
import { ConnectToServer } from './ConnectToServer'; | ||
|
||
const DEFAULT_BASE_URL = 'https://realm.mongodb.com'; | ||
const DEFAULT_BASE_URL = 'https://services.cloud.mongodb.com'; | ||
const LEGACY_BASE_URL = 'https://realm.mongodb.com'; | ||
|
||
/* | ||
const MISSING_PARAMS_MESSAGE = | ||
|
@@ -83,7 +84,7 @@ class ConnectToServerContainer extends React.Component< | |
const url = this.props.url || this.getLatestUrl(); | ||
this.setState({ | ||
// Use an empty input instead of filling in the default URL | ||
url: url === DEFAULT_BASE_URL ? '' : url, | ||
url: url === DEFAULT_BASE_URL || url === LEGACY_BASE_URL ? '' : url, | ||
appId: this.getLatestAppId(), | ||
}); | ||
// this.restoreCredentials(url); | ||
|
@@ -114,9 +115,8 @@ class ConnectToServerContainer extends React.Component< | |
const { appId, url } = this.state; | ||
// Use SDK default (passing undefined) on an empty string. | ||
const baseUrl = url || DEFAULT_BASE_URL; | ||
// Clear test state to invalidate the shared App cache as a work around for | ||
// TODO: Clear test state to invalidate the shared App cache as a work around for | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From my testing, I'm unable to reproduce this and it seems fair to disable the workaround for now. I'm leaving the comment for a future where this resurfaces. |
||
// https://github.com/realm/realm-js/issues/6276 | ||
(Realm.App as any)._clearAppCache(); | ||
const app = new App({ id: appId, baseUrl }); | ||
const serializedCredentials = this.serializeCredentials(); | ||
const credentials = hydrateCredentials(serializedCredentials); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -156,11 +156,12 @@ export abstract class RealmLoadingComponent< | |
}); | ||
const credentials = hydrateCredentials(realm.credentials); | ||
const user = await app.logIn(credentials); | ||
return new Realm({ | ||
return Realm.open({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using |
||
encryptionKey: realm.encryptionKey, | ||
sync: { | ||
user, | ||
flexible: true, | ||
/* | ||
initialSubscriptions: { | ||
update(subs, realm) { | ||
for (const schema of realm.schema) { | ||
|
@@ -169,6 +170,7 @@ export abstract class RealmLoadingComponent< | |
} | ||
}, | ||
}, | ||
*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Disabling the initial subscription, since this could potentially result in a huge download that we don't want to wait for. |
||
}, | ||
schema, | ||
schemaVersion, | ||
|
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 went ahead and updated the base URL in the PR as well.