Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArrayBuffers in attributes are not preserved #992

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

courajs
Copy link

@courajs courajs commented Jul 2, 2023

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.

@Michiel87
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants