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

Fix check for new records in JSONAPISerializer.serializeHasMany #8794

Merged
merged 1 commit into from
Aug 26, 2023

Conversation

dagroe
Copy link
Contributor

@dagroe dagroe commented Aug 24, 2023

Description

Use !Snapshot.isNew instead of Snapshot.record && !Snapshot.record.isNew to avoid the access to record. Accessing record creates an entry in instanceCache.record which causes the hasRecord checks in Snapshot to return true. This results in an error when serializing associated records via hasMany that have not been loaded.

fixes #8793

Use `!Snapshot.isNew` instead of `Snapshot.record && !Snapshot.record.isNew` to avoid the access to `record`. Accessing `record` creates an entry in `instanceCache.record` which causes the `hasRecord` checks in `Snapshot` to return true. This results in an error when serializing associated records via hasMany that have not been loaded.
@runspired runspired added 🎯 beta PR should be backported to beta 🎯 release PR should be backported to release 🎯 canary PR is targeting canary (default) 🎯 lts The PR should be backported to the most recent LTS 🏷️ bug This PR primarily fixes a reported issue labels Aug 26, 2023
@runspired runspired merged commit 03498a7 into emberjs:main Aug 26, 2023
17 of 19 checks passed
@runspired runspired added the lts-4-12 Long Term LTS Maintenance label Aug 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎯 beta PR should be backported to beta 🎯 canary PR is targeting canary (default) 🎯 lts The PR should be backported to the most recent LTS 🎯 release PR should be backported to release 🏷️ bug This PR primarily fixes a reported issue lts-4-12 Long Term LTS Maintenance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when updating record without loading sync related records first
2 participants