Open courajs opened 1 year ago
The docs describe:
Caches use immutable data maps from @orbit/immutable to store their actual data. This makes it incredibly efficient to clone caches, and thus memory sources, which has benefits we'll discuss shortly. The use of immutable data structures does not extend into the records themselves, which are stored as simple POJOs. Therefore, it's not necessary to use immutable access methods when working with records. There is some performance tradeoff involved here, because individual records must be cloned on mutation.
So doesnt look like a bug to me.
When fetching a record with an ArrayBuffer attribute, it is sometimes preserved, and other times becomes an empty object.
If I had to guess, it might be deep cloning the object with
JSON.parse(JSON.stringify(record))
which doesn't preserve ArrayBuffers.Maybe there is a way I'm supposed to be handling this with serializers, but the fact that updating an unrelated attribute causes the issue seems like a bug for sure.
Maybe this test belongs further down, but I was having trouble following all the abstractions.