-
-
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
unloadRecord after v2.12 #5328
Comments
I worked around it with record.get('_internalModel').transitionTo('deleted.saved'); right |
I've just tried upgrading to ED 3.0.1 and am still experiencing this issue. |
unloadRecord should not be use for client-side delete. I would recommend building a solution overtop of |
@runspired I thought the recent work by @hjdivad around unloadRecord was to bring back this client-side delete. I'm just confused now. |
@sly7-7 it brought it back for a small subset of cases where it could work. |
In that case, I think I must rework my client-side delete process of the object in my app. But won't deleteRecord let some "zombies" records, and so my application will leak ? |
If we shouldn't use unloadRecord how would you advise removing a record from the store? |
Indeed. If a record gets deleted on server how you make ED understand that? The right way should be to issue a `reload()`, but the server will return a 404 and ED will just blow up. If I issue a `destroyRecord()` the server will return 404 too. `deleteRecord` will leave a zombie object in my collections. That is, you can’t differentiate between something that is new, was deleted or never existed.
TL;DR If server says me “record id 42 was deleted by some other user” what was I supposed to do?
|
@JonathanBristow it's complicated :( I'll be looking into building an addon to experiment with this soon while we wait for json-api operations to finalize to give us a public api spec to follow. |
A better discussion of the true heart of this issue is in #5424 Closing in favor of that ticket. |
Hey :)
I have this simple piece of code (removing record from the store while notified by a websocket).
In ember-data 2.12 everything works as expected.
But after this version, I'm unable to track the origin (if someone know how to do it ?), but the store tries to re-fetch some unloaded models (and fail with a 404 from the server).
I'm also encoutering sometimes the
Cannot read property 'eachAttribute' of null
error that others seems to have on unload.The text was updated successfully, but these errors were encountered: