[go: up one dir, main page]

Skip to content

Releases: realm/realm-js

Realm JavaScript v12.12.0

23 Jul 10:10
9d80922
Compare
Choose a tag to compare

Deprecations

  • The callback for SyncSession.addProgressNotification taking transferred and transferable arguments is deprecated and will be removed. See Enhancements below for the new callback supporting both Flexible Sync and Partition-Based Sync. (#6743)
  • AppConfiguration.app is no longer used by Atlas Device Sync. It will be removed in future SDK releases and should not be used. (#6785)

Enhancements

  • Added support for "bridgeless" React Native on iOS and Android, a part of the "new architecture". (#6737)
  • Added progress notifications support for Flexible Sync using an estimate as the new callback argument. The estimate is roughly equivalent to an estimated value of transferred / transferable in the deprecated Partition-Based Sync callback. (#6743)
realm.syncSession?.addProgressNotification(
  ProgressDirection.Upload,
  ProgressMode.ReportIndefinitely,
  (estimate) => console.log(`progress: ${estimate}/1.0`)
);
  • It is no longer an error to set a base url for an App with a trailing slash - for example, https://services.cloud.mongodb.com/ instead of https://services.cloud.mongodb.com - before this change that would result in a 404 error from the server. (realm/realm-core#7791)
  • Performance has been improved for range queries on integers and timestamps when using the BETWEEN operator. (realm/realm-core#7785)
  • On Windows devices Device Sync will additionally look up SSL certificates in the Windows Trusted Root Certification Authorities certificate store when establishing a connection. (realm/realm-core#7882)
  • Role and permissions changes no longer require a client reset to update the Realm on-device. (realm/realm-core#7440)

Fixed

  • Opening an Flexible Sync Realm asynchronously may not wait to download all data. (realm/realm-core#7720, since v10.12.0)
  • Clearing a list of mixed in an upgraded file would lead to an assertion failing. (realm/realm-core#7771, since 12.7.0-rc.0)
  • Sync client can crash if a session is resumed while the session is being suspended. (realm/realm-core#7860, since v10.18.0)
  • If a sync session is interrupted by a disconnect or restart while downloading a bootstrap, stale data from the previous bootstrap may be included when the session reconnects and downloads the bootstrap. This can lead to objects stored in the database that do not match the actual state of the server and potentially leading to compensating writes. (realm/realm-core#7827, since v10.18.0)
  • Fixed unnecessary server roundtrips when there is no download to acknowledge. (realm/realm-core#2129, since v12.10.0)
  • Realm.App.Sync.SyncSession#uploadAllLocalChanges() was inconsistent in how it handled commits which did not produce any changesets to upload. Previously it would sometimes complete immediately if all commits waiting to be uploaded were empty, and at other times it would wait for a server roundtrip. It will now always complete immediately. (realm/realm-core#7796)
  • Realm#writeCopyTo() on an encrypted Realm without explicitly specifying a new encryption key would only work if the old key happened to be a valid nul-terminated string. (realm/realm-core#7842, since v12.10.0).
  • You could get unexpected merge results when assigning to a nested collection. (realm/realm-core#7809, since v12.7.0-rc.0)
  • When mapTo is used to have an alias for a property name, Realm.Results#sorted() doesn't recognize the alias leading to errors like Cannot sort on key path 'NAME': property 'PersonObject.NAME' does not exist. (#6779, since v11.2.0)
  • A mixed property with a collection could sometimes end up with a combination of values assigned by different clients. (realm/realm-core#7809, since v12.9.0)
  • Fixed removing backlinks from the wrong objects if the link came from a nested list, nested dictionary, top-level dictionary, or list of mixed, and the source table had more than 256 objects. This could manifest as array_backlink.cpp:112: Assertion failed: int64_t(value >> 1) == key.value when removing an object. (realm/realm-core#7594, since v10.6.0)
  • Fixed a bug when removing an object from a nested collection could lead to an assert with the message array.cpp:319: Array::move() Assertion failed: begin <= end [2, 1]. (realm/realm-core#7839, since v12.9.0)

Compatibility

  • React Native >= v0.71.4
  • Realm Studio v15.0.0.
  • File format: generates Realms with format v24 (reads and upgrades file format v10).

Internal

  • Adding a CallInvoker-based scheduler for Core on React Native and removing the "flush ui queue" workaround. (#6791)
  • Refactors throwing uncaught exceptions from callbacks dispatched onto the event loop from C++ on React Native. (#6772)
  • Upgraded Realm Core from v14.10.0 to v14.11.0. (#6744

Realm React v0.9.0

17 Jul 11:12
2238a9c
Compare
Choose a tag to compare

Enhancements

  • Added the ability to pass an existing Realm.App instance in AppProvider with the app prop. (#6785)
import { AppProvider } from "@realm/react";

const app = new Realm.App(...);

function MyApp() {
  return (
    <AppProvider app={app}> 
      ...
    </AppProvider>
  );
}

Fixed

  • Fixed listener that was not being removed during unmounting of useObject and useQuery if the listener was added in a write transaction. (#6552) Thanks @bimusiek!
  • The app prop in AppProvider meant for LocalAppConfiguration was not being used by Atlas Device Sync and has been removed. app is now only used to pass an existing Realm.App to the provider. (#6785)

Compatibility

  • React Native >= v0.71.4
  • See "Compatibility" for a specific Realm version in Realm's CHANGELOG.

Realm JavaScript v12.11.1

25 Jun 13:03
f8dd36a
Compare
Choose a tag to compare

Fixed

  • path option in the Realm configuration not being set when using a synced Realm. (#6754, since v12.8.0). Note: if you have been using a custom path configuration with your synced Realm, this fix will lead to a re-download of its data in the custom path.

Compatibility

  • React Native >= v0.71.4
  • Realm Studio v15.0.0.
  • File format: generates Realms with format v24 (reads and upgrades file format v10).

Realm JavaScript v12.11.0

18 Jun 08:50
cfdfe11
Compare
Choose a tag to compare

Enhancements

  • Building for iOS and Android has been optimized for compatibility with future React Native versions, by deferring compilation of JSI dependent code to the dependent app's build. (#6650)

Fixed

  • None

Compatibility

  • React Native >= v0.71.4
  • Realm Studio v15.0.0.
  • File format: generates Realms with format v24 (reads and upgrades file format v10).

Realm React v0.8.0

18 Jun 15:05
7c6b66b
Compare
Choose a tag to compare

Enhancements

  • Added the ability to use an existing Realm instance in RealmProvider and createRealmContext. (#6714)
// Using RealmProvider
import { RealmProvider } from "@realm/react";

const realm = new Realm(...);

function MyApp() {
  return (
    <RealmProvider realm={realm}> 
      ...
    </RealmProvider>
  );
}

// Using createRealmContext
import { createRealmContext } from "@realm/react";

const realm = new Realm(...);
const { RealmProvider, useRealm } = createRealmContext(realm);

function MyApp() {
  return (
    <>
      <RealmProvider> 
        ...
      </RealmProvider>
      <AnotherComponent>
        {/* Note: The hooks returned from `createRealmContext` using an existing Realm can be used outside of the scope of the provider! */}
      </AnotherComponent>
    </>
  );

Compatibility

  • React Native >= v0.71.4
  • See "Compatibility" for a specific Realm version in Realm's CHANGELOG.

Realm JavaScript v12.10.0

14 Jun 11:18
c0f32c5
Compare
Choose a tag to compare

Enhancements

  • Report the originating error that caused a client reset to occur. (realm/realm-core#6154)
  • Reduce the size of the local transaction log produced by creating objects, improving the performance of insertion-heavy transactions. (realm/realm-core#7734)
  • A counter presentation data type has been introduced. The int data type can now be used as a logical counter for performing numeric updates that need to be synchronized as sequentially consistent events rather than individual reassignments of the number. (#6694)
    • See the API docs for more information about the usage, or get a high-level introduction about counters in the documentation.
class MyObject extends Realm.Object {
  _id!: BSON.ObjectId;
  counter!: Realm.Types.Counter;

  static schema: ObjectSchema = {
    name: "MyObject",
    primaryKey: "_id",
    properties: {
      _id: { type: "objectId", default: () => new BSON.ObjectId() },
      counter: "counter",
      // or: counter: { type: "int", presentation: "counter" },
    },
  };
}

const realm = await Realm.open({ schema: [MyObject] });
const object = realm.write(() => {
  return realm.create(MyObject, { counter: 0 });
});

realm.write(() => {
  object.counter.increment();
  object.counter.value; // 1
  object.counter.decrement(2);
  object.counter.value; // -1
});

Fixed

  • After compacting, a file upgrade would be triggered. This could cause loss of data for synced Realms. (realm/realm-core#7747, since 12.7.0-rc.0)
  • The function immediatelyRunFileActions was not added to the bindgen's opt-list. This could lead to the error TypeError: app.internal.immediatelyRunFileActions is not a function. (#6708, since v12.8.0)
  • Encrypted files on Windows had a maximum size of 2 GB even on x64 due to internal usage of off_t, which is a 32-bit type on 64-bit Windows. (realm/realm-core#7698, since the introduction of encryption support on Windows - likely in v1.11.0)
  • Tokenizing strings for full-text search could lead to undefined behavior. (realm/realm-core#7698, since v11.3.0-rc.0)
  • A non-streaming progress notifier would not immediately call its callback after registration. Instead you would have to wait for a download message to be received to get your first update - if you were already caught up when you registered the notifier you could end up waiting a long time for the server to deliver a download that would call/expire your notifier. (#7627, since v12.8.0)

Compatibility

  • React Native >= v0.71.4
  • Realm Studio v15.0.0.
  • File format: generates Realms with format v24 (reads and upgrades file format v10).

Internal

  • Upgraded Realm Core from v14.7.0 to v14.10.0. (#6701)
  • Added privacy manifest for Apple App Store. First released in v12.8.1-alpha.0 only. (#6638)

Realm JavaScript v12.10.0-rc.0

31 May 14:56
b121047
Compare
Choose a tag to compare
Pre-release

Enhancements

  • A counter presentation data type has been introduced. The int data type can now be used as a logical counter for performing numeric updates that need to be synchronized as sequentially consistent events rather than individual reassignments of the number. (#6694)
class MyObject extends Realm.Object {
  _id!: BSON.ObjectId;
  counter!: Realm.Types.Counter;

  static schema: ObjectSchema = {
    name: "MyObject",
    primaryKey: "_id",
    properties: {
      _id: { type: "objectId", default: () => new BSON.ObjectId() },
      counter: "counter",
      // or: counter: { type: "int", presentation: "counter" },
    },
  };
}

const realm = await Realm.open({ schema: [MyObject] });
const object = realm.write(() => {
  return realm.create(MyObject, { counter: 0 });
});

realm.write(() => {
  object.counter.increment();
  object.counter.value; // 1
  object.counter.decrement(2);
  object.counter.value; // -1
});

Fixed

  • A non-streaming progress notifier would not immediately call its callback after registration. Instead you would have to wait for a download message to be received to get your first update - if you were already caught up when you registered the notifier you could end up waiting a long time for the server to deliver a download that would call/expire your notifier. (#7627, since v12.8.0)

Compatibility

  • React Native >= v0.71.4
  • Realm Studio v15.0.0.
  • File format: generates Realms with format v24 (reads and upgrades file format v10).

Internal

  • Upgraded Realm Core from v14.7.0 to v14.9.0.

Realm Web v2.0.1

30 May 12:34
21d9038
Compare
Choose a tag to compare

Note

This version communicates with Atlas Device Services through a different URL (https://services.cloud.mongodb.com). While we consider this an internal detail of the SDK, you might need to update rules in firewalls or other configuration that you've used to limit connections made by your app.

Fixed

  • Fixed an endless loop of requests that would happen if linking credentials failed due to an authentication failure. (#6588, since v0.6.0)
  • Logging in with Credentials.anonymous() credentials will now reuse any existing anonymous user which is already authenticated with the app. This aligns with the behaviour of the realm package and will result in less users being created. Use Credentials.anonymous(false) to disable this behaviour and achieve the old behaviour of creating new anonymous users on every login. (#6592)
  • Fixed crash in Chrome from calling stream.return() on a watch stream. (PR #6688)

Internal

Realm JavaScript v12.9.0

23 May 12:10
0acc003
Compare
Choose a tag to compare

Enhancements

  • A mixed value can now hold a Realm.List and Realm.Dictionary with nested collections. Note that Realm.Set is not supported as a mixed value. (#6613)
class CustomObject extends Realm.Object {
  value!: Realm.Types.Mixed;

  static schema: ObjectSchema = {
    name: "CustomObject",
    properties: {
      value: "mixed",
    },
  };
}

const realm = await Realm.open({ schema: [CustomObject] });

// Create an object with a dictionary value as the Mixed
// property, containing primitives and a list.
const realmObject = realm.write(() => {
  return realm.create(CustomObject, {
    value: {
      num: 1,
      string: "hello",
      bool: true,
      list: [
        {
          string: "world",
        },
      ],
    },
  });
});

// Accessing the collection value returns the managed collection.
const dictionary = realmObject.value;
expectDictionary(dictionary);
const list = dictionary.list;
expectList(list);
const leafDictionary = list[0];
expectDictionary(leafDictionary);
console.log(leafDictionary.string); // "world"

// Update the Mixed property to a list.
realm.write(() => {
  realmObject.value = [1, "hello", { newKey: "new value" }];
});

// Useful custom helper functions. (Will be provided in a future release.)
function expectList(value: unknown): asserts value is Realm.List {
  if (!(value instanceof Realm.List)) {
    throw new Error("Expected a 'Realm.List'.");
  }
}
function expectDictionary(value: unknown): asserts value is Realm.Dictionary {
  if (!(value instanceof Realm.Dictionary)) {
    throw new Error("Expected a 'Realm.Dictionary'.");
  }
}

Fixed

  • Inserting the same typed link to the same key in a dictionary more than once would incorrectly create multiple backlinks to the object. This did not appear to cause any crashes later, but would have affecting explicit backlink count queries (eg: ...@links.@count) and possibly notifications (realm/realm-core#7676 since v12.7.1).
  • Having links in a nested collections would leave the file inconsistent if the top object is removed. (realm/realm-core#7657, since v12.7.0)
  • Automatic client reset recovery would crash when recovering AddInteger instructions on a Mixed property if its type was changed to non-integer (realm/realm-core#7683, since v10.18.0).

Compatibility

  • React Native >= v0.71.4
  • Realm Studio v15.0.0.
  • File format: generates Realms with format v24 (reads and upgrades file format v10).

Internal

  • Upgraded Realm Core from v14.6.2 to v14.7.0.
  • Upgraded @trunk/launcher from v1.3.0 to v1.3.1 to support Apple's versioning scheme for macOS.

Realm JavaScript v12.8.1

15 May 09:52
2deec02
Compare
Choose a tag to compare

Fixed

  • Fixed a crash experienced on React Native when accessing Realm.deleteFile, Realm.exists, Realm.schemaVersion, Realm.determinePath, Realm.transformConfig and User#isLoggedIn. (#6662, since v12.8.0)
  • Accessing Realm.App#currentUser from within a notification produced by Realm.App.switchUser (which includes notifications for a newly logged in user) would deadlock. (realm/realm-core#7670, since v12.8.0)
  • Fixed a bug when running an IN query on a string/int/uuid/objectId property that was indexed. (realm/realm-core#7642 since v12.8.0)
  • Fixed a bug when running an IN query on an int property where double/float parameters were ignored. (realm/realm-core#7642 since v12.8.0)

Compatibility

  • React Native >= v0.71.4
  • Realm Studio v15.0.0.
  • File format: generates Realms with format v24 (reads and upgrades file format v10.

Internal

  • Upgraded Realm Core from v14.6.1 to v14.6.2 + commits 5ba02142131efa3d97eda770ce33a85a2a085202 and 5462d47998b86459d328648c8057790a7b92af20.