-
Type: Task
-
Resolution: Unresolved
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
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