-
-
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 doesn't always clean up relationships #5424
Comments
The expected behavior is that While using unloadRecord in the above way is not a correct design (think of unloadRecod as I suspect that this might be a manifestation of #5425, I'll have to double-check whether internal-models are removed from the identity-map during an |
Also to follow up for casual travelers interested in solving this sort of situation, @DingoEatingFuzz and I had an out-of-band discussion that led to more correct solution: using |
Closing in favor of #5425 |
Reopening because tests confirmed this is a separate issue. |
Tested in 2.17 and 2.18
Reproduction Repo: https://github.com/DingoEatingFuzz/ed-unload-record-bug
Reproduction Hosted: https://dingoeatingfuzz.github.io/ed-unload-record-bug/
I have the need to remove records from the local store when they no longer come back from server-sent responses. As far as I know, there is no way to do this with ED out of the box, so I have written some special behavior in my application serializer and adapter to do this work.
In my application adapter (unfortunately it has to be the adapter), I am handling the bookkeeping for
hasMany
relationships. The code looks like this:https://github.com/DingoEatingFuzz/ed-unload-record-bug/blob/8dcd31f9bb3dce830758485fa92beb58cbca7abf/app/adapters/application.js#L4-L20
This has the intended effect of removing records from the store, but it doesn't update the relationships the unloaded records are members of.
Example:
The text was updated successfully, but these errors were encountered: