angular2-jsonapi icon indicating copy to clipboard operation
angular2-jsonapi copied to clipboard

Delete/update model in datastore only

Open Wizofgoz opened this issue 7 years ago • 2 comments

Is there a way to only delete and/or update a model from the datastore and not make a request? I see there are functions such as peekRecord() and addToStore() so the C & R of CRUD seem to be supported but not UD.

My use case is that the client will be receiving websocket CRUD events for models on the backend. I would like to keep a single source of truth regarding the model data and be able to be able to perform the full CRUD on the datastore.

Wizofgoz avatar Nov 30 '18 01:11 Wizofgoz

I have a similar problem. I would like to update an element in the datastore without triggering the hasDirtyAttributes flag (see my issue #207). But this is only the U part of what you are asking. I don't know how to delete a record from the datastore.

But if you do all your CRUD on the server and inform your client via a websocket, why do you need JSON-API anyway? The main advantage of this specification is, that you don't have to think about, how the server and client exchange resources. And if you do this all by your own, couldn't you just use a simple datastore like Redux? There seems to be already some tutorials on how to integrate this with websockets: https://medium.com/@ianovenden/redux-websocket-integration-c1a0d22d3189

hpawe01 avatar Dec 13 '18 15:12 hpawe01

I have same question, how i can delete model instances from store without make request ?

monkeycatdog avatar Oct 08 '19 14:10 monkeycatdog