-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Allow Store#pushPayload to delete records in store #1945
Comments
We've run into something similar on a current project. We're using an EventSource to push data to a client and we include a flag similar to the |
Yea, I'm implementing something like that with Websockets. Seems like a very common pattern, might be nice to support it. |
@wycats any thoughts? |
We do something similar but include a type along with our payload. {
"id": "123",
"type": "post",
"method": "create",
"data": {}
} or {
"id": "123",
"type": "post",
"method": "delete"
} So in the case of create/update we can use pushPayload and delete we can run a deleteRecord on it. I could definitely see the benefit of just using pushPayload and avoid some of that code we have. I assume syncing front and backend data is a somewhat common practice. |
I think this should definitely be supported by ember-data, but it might be a good idea to go through the process of RFC so the specific API can be fleshed out. Closing this in favor of being discussed further at https://github.com/emberjs/rfcs |
This is how tickets get lost. |
@nixpulvis you're right! Reopening and will close once such a PR exists. |
This would indeed be very useful. |
Would something like this need to make it's way in to JSON API first? |
+1, I could use this too. Although I'm still stuck on the |
@Asherlc, yep. Having such a functionality defined in JSON-API at first would definitely help this issue being moved forward. json-api/json-api#795 (comment) is a relevant comment. |
emberjs/rfcs#854 adds operations to the cache, all we need now is an addition to it for deletions :) |
closing in favor of the above RFC adding it now |
It would be nice to allow the deletion of records via a specially formatted message passed to
Store#pushPayload
. This would allow api designers to send a message for a record indicating it was deleted.The use case for this for me at the moment is for integration with WebSockets. I'm building an adapter which calls
pushPayload
when it receives a message.Maybe sending a message like
Allowing this to also remove records would be awesome.
The text was updated successfully, but these errors were encountered: