Uploaded image for project: 'Realm JavaScript SDK'
  1. Realm JavaScript SDK
  2. RJS-147

Clarify snapshot shallow/deep immutability in the docs

      According to the docs snapshot "Create[s] a frozen snapshot of the results. This means changes to the list will not be reflected in the results returned by this method."

      However, while the list itself is immutable/frozen, the objects inside it are not. Is that working as intended? If so, it'd be nice if the docs were more specific about that.

      e.g.

      realm.write(() => realm.create('Foo', { text: 'bar' }))
      let copy = objects.snapshot();
      console.log(`Before ${copy[0].text} : ${objects[0].text}`);
      realm.write(() => objects[0].text = 'baz');
      console.log(`After ${copy[0].text} : ${objects[0].text}`);
      
      Before bar : bar
      After baz : baz
      

      Versus what I (a Realm noob, admittedly) expected:

      Before bar : bar
      After bar : baz
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: