Skip to content

Commit

Permalink
Realm.Configuration.sync can be a boolean (#4616)
Browse files Browse the repository at this point in the history
* Realm.Configuration.sync can be a boolean

Co-authored-by: Kræn Hansen <[email protected]>
  • Loading branch information
kneth and kraenhansen authored Jun 7, 2022
1 parent b63a2c0 commit 0fb0967
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ x.x.x Release notes (yyyy-MM-dd)
* <Either mention core version or upgrade>
* <Using Realm Core vX.Y.Z>
* <Upgraded Realm Core from vX.Y.Z to vA.B.C>
* Fixed a bug preventing opening a synced Realm as a local Realm. (since v10.18.0)

10.19.0 Release notes (2022-6-2)
=============================================================
Expand Down
7 changes: 4 additions & 3 deletions src/js_realm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ void RealmClass<T>::handle_initial_subscriptions(ContextType ctx, size_t argc, c
ObjectType config_object = Value::to_object(ctx, config_value);

ValueType sync_value = Object::get_property(ctx, config_object, "sync");
if (Value::is_undefined(ctx, sync_value)) {
if (!Value::is_object(ctx, sync_value)) {
return;
}
ObjectType sync_object = Value::validated_to_object(ctx, sync_value);
Expand Down Expand Up @@ -1564,8 +1564,9 @@ realm::Realm::Config RealmClass<T>::write_copy_to_helper(ContextType ctx, Object
// validate 5)
// check whether a sync config exists -- it is optional
ValueType syncConfigValue = Object::get_property(ctx, output_config, "sync");
if (!Value::is_undefined(ctx, syncConfigValue) && !Value::is_object(ctx, syncConfigValue)) {
throw std::invalid_argument("'sync' property must be an object");
if (!Value::is_undefined(ctx, syncConfigValue) && !Value::is_object(ctx, syncConfigValue) &&
!Value::is_boolean(ctx, syncConfigValue)) {
throw std::invalid_argument("if set, 'sync' property must be an object or a boolean");
}


Expand Down

0 comments on commit 0fb0967

Please sign in to comment.