realm / realm-core

Core database component for the Realm Mobile Database SDKs
https://realm.io
Apache License 2.0
1.01k stars 155 forks source link

Missing notification for backlink #7674

Open papafe opened 4 months ago

papafe commented 4 months ago

It seems notifications for backlinks are not being raised. I have got the following .NET test:

  [Test]
  public void ABackLinkTest()
  {
      var testObject = new TestNotificationObject();
      _realm.Write(() => _realm.Add(testObject));
      var notificationCount = 0;

      testObject.PropertyChanged += (sender, e) =>
      {
          notificationCount++;
      };
      Assert.That(testObject.Backlink.Count, Is.EqualTo(0));

      _realm.Write(() =>
      {
          var newTestOb = new TestNotificationObject();
          newTestOb.LinkSameType = testObject;
          _realm.Add(newTestOb);
      });
      _realm.Refresh();
      Assert.That(testObject.Backlink.Count, Is.EqualTo(1));
      Assert.That(notificationCount, Is.EqualTo(1));
  }

(https://github.com/realm/realm-dotnet/blob/6c5e5bdfd0fcc720aa7c8469612de1cb29619a68/Tests/Realm.Tests/Database/NotificationTests.cs#L209-L231)

The test fails at the last assertion (the first empty notification is swallowed up). I’ve tried both by passing a null keypath array or just the backlink property, but the result is the same. I can see that the notifications is raised in core, but it’s practically empty (no columns, no add/delete/.. indexes). I've managed to reproduce this also in js and dart.

sync-by-unito[bot] commented 4 months ago

➤ PM Bot commented:

Jira ticket: RCORE-2114

jedelbo commented 3 weeks ago

@papafe if you can provide the reproduction case in js, I can try to look into it.