Skip to content

Realm JavaScript v12.10.0-rc.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 31 May 14:56
· 108 commits to main since this release
b121047

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.