-
Notifications
You must be signed in to change notification settings - Fork 585
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
Cannot compare realm.syncSession?.connectionState === Realm.ConnectionState[enumValue]
#5480
Comments
In the current latest version of the SDK, this enum is exported on Does this work?
|
That being said. I agree we have an issue here, because we are indeed declaring this on the root level too. |
thank you for the speedy feedback @kraenhansen! |
hi kraen, i've upgraded realm to 11.5.0, and the same issue persists. no change in behavior. |
Are you still using |
@kraenhansen, I'm seeing the same behavior with the Using this behavior config object: const realmAccessBehavior: Realm.OpenRealmBehaviorConfiguration = {
type: Realm.OpenRealmBehaviorType.OpenImmediately,
}; Results in a TypeError:
But providing the value of the enum compiles just fine: const realmAccessBehavior: Realm.OpenRealmBehaviorConfiguration = {
type: 'openImmediately',
}; |
@krollins-mdb Thanks for highlighting this 👍 It seems we never provided an implementation for that, which is ... very unfortunate. I've made a quick PR for that: #5493 |
How frequently does the bug occur?
Always
Description
when checking the value of Realm.syncSession.connectionState enum using an equality operator, such as:
this code throws the following error:
However, if I use the value of the enum (which i found by looking at the source code), things work as expected. For example:
I believe this might be related to some funky TS enum behavior, as talked about here https://stackoverflow.com/questions/50365598/typescript-runtime-error-cannot-read-property-of-undefined-enum (perhaps it's this issue?)
Additionally, in the API reference for this method, it describes the enum as accessible from
Realm.App.Sync.ConnectionState
, however in the SDK the enum is accessed throughRealm.ConnectionState
.Also, the reference docs describe
connectionState
as a method, but in the SDK it is a property.Also the docs for discussing
realm.syncSession?.connectionState
are pretty wrong (but I guess that's my problem to fix )Stacktrace & log output
No response
Can you reproduce the bug?
Always
Reproduction Steps
No response
Version
realm@11.4.0 with @realm/react@0.4.1
What services are you using?
Atlas Device Sync
Are you using encryption?
No
Platform OS and version(s)
macOS 12.6.3
Build environment
Which debugger for React Native:
using React Native Testing Library, which i believe runs in a Node.js process.
Cocoapods version
No response
The text was updated successfully, but these errors were encountered: