diff --git a/CHANGELOG.md b/CHANGELOG.md index f64f38abb0..8f85c0dd29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,10 +6,20 @@ ### Enhancements * Added a new error class `CompensatingWriteError` which indicates that one or more object changes have been reverted by the server. This can happen when the client creates/updates objects that do not match any subscription, or performs writes on an object it didn't have permission to access. ([#5599](https://github.com/realm/realm-js/pull/5599)) +* Performance improvement for the following queries ([realm/realm-core#6376](https://github.com/realm/realm-core/issues/6376)): + * Significant (~75%) improvement when counting (`Realm.Results#length`) the number of exact matches (with no other query conditions) on a `string`/`int`/`uuid`/`objectId` property that has an index. This improvement will be especially noticiable if there are a large number of results returned (duplicate values). + * Significant (~99%) improvement when querying for an exact match on a `date` property that has an index. + * Significant (~99%) improvement when querying for a case insensitive match on a `mixed` property that has an index. + * Moderate (~25%) improvement when querying for an exact match on a `bool` property that has an index. + * Small (~5%) improvement when querying for a case insensitive match on a `mixed` property that does not have an index. ### Fixed * Fixed passing RealmObject instances between shared Realms. ([#5634](https://github.com/realm/realm-js/pull/5634), since v12.0.0-alpha.0) -* ([#????](https://github.com/realm/realm-js/issues/????), since v?.?.?) +* Fixed a crash when querying a `mixed` property with a string operator (`contains`/`like`/`beginswith`/`endswith`) or with case insensitivity. ([realm/realm-core#6376](https://github.com/realm/realm-core/issues/6376, since v10.5.0) +* Querying for equality of a string on an indexed `mixed` property was returning case insensitive matches. For example querying for `myIndexedMixed == "Foo"` would incorrectly match on values of `"foo"` or `"FOO"`. ([realm/realm-core#6376](https://github.com/realm/realm-core/issues/6376), since v10.5.0) +* Adding an index to a `mixed` property on a non-empty class/objectType would crash with an assertion. ([realm/realm-core#6376](https://github.com/realm/realm-core/issues/6376), since v10.5.0) +* `Realm.App.Sync#pause()` could hold a reference to the database open after shutting down the sync session, preventing users from being able to delete the Realm. ([realm/realm-core#6372](https://github.com/realm/realm-core/issues/6372), since v11.5.0) +* Fixed a bug that may have resulted in `Realm.Results` and `Realm.List` being in different orders on different devices. Moreover, some cases of the error message `Invalid prior_size` may have be fixed too. ([realm/realm-core#6191](https://github.com/realm/realm-core/issues/6191), since v10.15.0) ### Compatibility * React Native >= v0.71.0 @@ -18,6 +28,7 @@ This can happen when the client creates/updates objects that do not match any su ### Internal * Fixed linting issues and running linting on CI. +* Upgraded Realm Core from v13.6.0 to v13.8.0. ([#5638](https://github.com/realm/realm-js/pull/5638)) diff --git a/packages/bindgen/spec.yml b/packages/bindgen/spec.yml index e864a6c7d9..aa0fd8a6e4 100644 --- a/packages/bindgen/spec.yml +++ b/packages/bindgen/spec.yml @@ -633,6 +633,16 @@ classes: get_results_description: '(results: const Results&) -> StringData' feed_buffer: '(ws: WatchStream&, buffer: BinaryData)' + Logger: + cppName: util::Logger + sharedPtrWrapped: SharedLogger + properties: + get_default_logger: SharedLogger + get_default_level_threshold: LoggerLevel + staticMethods: + set_default_logger: '(logger: SharedLogger)' + set_default_level_threshold: '(level: LoggerLevel)' + ConstTableRef: needsDeref: true iterable: Obj diff --git a/packages/bindgen/src/realm_js_helpers.h b/packages/bindgen/src/realm_js_helpers.h index f0336e739e..70e239ca4f 100644 --- a/packages/bindgen/src/realm_js_helpers.h +++ b/packages/bindgen/src/realm_js_helpers.h @@ -222,10 +222,10 @@ struct Helpers { { std::error_code error_code(code, type == "realm::sync::ProtocolError" ? realm::sync::protocol_error_category() : realm::sync::client_error_category()); - SyncError error{error_code, message, is_fatal}; + sync::SessionErrorInfo error{error_code, message, is_fatal}; error.server_requests_action = code == 211 ? sync::ProtocolErrorInfo::Action::ClientReset : sync::ProtocolErrorInfo::Action::Warning; - SyncSession::OnlyForTesting::handle_error(session, error); + SyncSession::OnlyForTesting::handle_error(session, std::move(error)); } // This is entirely because ThreadSafeReference is a move-only type, and those are hard to expose to JS. diff --git a/packages/realm/src/binding.ts b/packages/realm/src/binding.ts index 3476207682..db81c3d5ea 100644 --- a/packages/realm/src/binding.ts +++ b/packages/realm/src/binding.ts @@ -17,6 +17,7 @@ //////////////////////////////////////////////////////////////////////////// import { IndexSet, Int64, ObjKey, Timestamp } from "../generated/ts/native.mjs"; +import { binding } from "./internal.js"; /** @internal */ export * from "../generated/ts/native.mjs"; // core types are transitively exported. @@ -73,3 +74,6 @@ export function isEmptyObjKey(objKey: ObjKey) { // This relies on the JS representation of an ObjKey being a bigint return Int64.equals(objKey as unknown as Int64, -1); } + +// Silence logs from core by default +binding.Logger.setDefaultLevelThreshold(binding.LoggerLevel.Off); diff --git a/vendor/realm-core b/vendor/realm-core index dd91f5f967..3c950f43ba 160000 --- a/vendor/realm-core +++ b/vendor/realm-core @@ -1 +1 @@ -Subproject commit dd91f5f967c4ae89c37e24ab2a0315c31106648f +Subproject commit 3c950f43bafc4fe39ce605e913cc7f30426e1747