Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Delete records from the adapter #519

Closed
calexicoz opened this Issue · 3 comments

2 participants

@calexicoz

Related to #68 and #200.

When the backend is able to push information to clients, we need a way to mark a record as deleted from the adapter.

It is already possible to load new records and update them via store.load(type, id, data), and we also have model.unloadRecord, but this requires having access to the model, which is not straightforward from the adapter without calling private methods on the store. I'd like to have store.unload(type, id) so that I can delete record directly from the adapter when I receive realtime updates from the server.

There might already be a simple way to do this that I'm not aware of.

Thanks!

@sly7-7
Collaborator

I think you can call store.find(id).deleteRecord(), which I think is pretty straightforward. @calexicoz Do you agree ?

@calexicoz

That should work. I can keep track of what's already been deleted in the adapter and simply not make a server call. I haven't worked on this for a while, so let's simply close it for now, and I'll reopen it if I run into troubles.

Thanks!

@calexicoz calexicoz closed this
@sly7-7
Collaborator

Thank you :). Keep in mind that store.find('id') will not hit the server if the record is already into the store. In combination with store.recordIsLoaded(id), you should be able to do you job in the adapter pretty easily :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.