ghidoz / angular2-jsonapi

A lightweight Angular 2 adapter for JSON API
199 stars 124 forks source link

"createOrPeek" produces missing data on second "findRecord" with relationships and sparse fieldsets #69

Open kimpixel opened 7 years ago

kimpixel commented 7 years ago

Hi

I use findRecord method with include a relationship and sparse fieldsets:

        return this.datastore.findRecord(Task, id, {
            include: 'taskType',
            fields: {
                taskType: 'name',
            }
        });

Only "name" will selected on "taskType"

Now the second call of the method (and all others methods like query etc.)

        return this.datastore.findRecord(Task, id, {
            include: 'taskType',
            fields: {
                taskType: 'name,desciption,foo,far',
            }
        });

This will not update the fields "desciption,foo,far" in the model "taskType"

I can also see any functions to handle it. For example "clearStore", or removeFromStore

What can i do?

HennerM commented 7 years ago

Are you sure this issue occurs on multiple calls to findRecord? I will try to reproducing it.

chaumo commented 7 years ago

This may be related yo what I've just posted on #105

mh453Uol commented 5 years ago

Seems related to this issue https://github.com/ghidoz/angular2-jsonapi/issues/240 but it updates the model but the hasDirtyAttribute is true when it should be false since we got a fresh copy of the data from the server on the second request.