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

JSONAPIAdapter sends all properties for PATCH #4721

Closed
wayne-o opened this issue Dec 20, 2016 · 2 comments
Closed

JSONAPIAdapter sends all properties for PATCH #4721

wayne-o opened this issue Dec 20, 2016 · 2 comments

Comments

@wayne-o
Copy link

wayne-o commented Dec 20, 2016

I've began using the Json Api Adapter in my app and have a compliant backend running and it's all smooth.

Only issue I have found is that when I update a property on a model and then .save it - i see that all of the properties on that model are sent to the server as a PATCH request. In my understanding this should be limited to the properties that have changed and require an update?

@wecc
Copy link
Contributor

wecc commented Dec 20, 2016

Thank for the issue!

Basically ED doesn't yet support dirty relationships - only dirty attributes. That's the reason why we haven't updated the serializer to pass only modified attributes and relationships.

This is being worked on and tracked in #3467 (there are workarounds in that thread)

@runspired
Copy link
Contributor

runspired commented Sep 4, 2023

The solution to this now (as of 5.3) is to use the serialization utils or the cache APIs for changed relationships directly:

These are introduced here: #8824

e.g. if using JSON:API

import { serializePatch } from '@ember-data/json-api/request';

const patch = serializePatch(cache, identifier);

Or more directly if you want to specifically work with the diffs:

const  changed = cache.changedRelationships(identifier);

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

No branches or pull requests

3 participants