-
-
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
Loading a previously unloaded record doesn't update relationships #5136
Comments
Just a little more poking around. This functionality last worked correctly in |
@workmanw thanks for the failing test |
You're welcome! Let me know if there is anything else I can do to help. |
@workmanw mind adding another test for:
That way we can fix both these issues and ensure they don't come back |
ooo my favorite ... |
@stefanpenner Sure thing, I'll add another test now. |
@stefanpenner Actually, as I'm trying to write another test, I'm realizing that it may not be a valid use case. The reason is when you unload an async relationship, it still leaves the
As you can see, just unloading the boat, no long tears down the relationship because it's async (which logically makes sense to me). As for the error I mentioned, it turns out this was a different problem altogether. TL;DR; if I unload a model, then try to refetch it via it's async relationship and that fails, it throws a crash because
I think this should be written up separately. |
👍
👍 |
I've identified in broad strokes the issue, but haven't isolated the exact problem yet. The issue as I see it so far, is if an internalModel is resurrected (unloaded, but still retained by an async relationship) \w updated relationship info, that relationship info isn't propagated to the inverse (in the case, person.boats is not updated). I'll try to find more time later today to investigate further... I'll need to talk to @hjdivad, see what makes the most sense short-term, as we have a future path forward. On a positive note, I found several other things while debugging this: |
@stefanpenner Is there anything I can do to help here? I know you're working hard on it and don't want to rush you. If I can't come up with a workaround for this, I'm faced with downgrading ember-data to 2.12 again for our next release. |
@workmanw Can you please update the demo to the latest Ember CLI, Ember & Ember Data? That would indicate that the issue is not covered by bugfixes from ED 2.15. |
@lolmaus @stefanpenner -- Yes, this is still an issue with ember-data-2.15. I've updated my repo and my live example to use latest of Ember, Ember CLI and Ember Data. Any help here would be greatly appreciated. Our application is stuck back on 2.12 because of all these unloadRecord issues. |
@stefanpenner et al -- Is there anything that can be done to move this forward? I'm sorry to be a pest here, but this has locked us 3 releases behind (soon to be 4). We've explored every work around we can think of and can't seem to find a way to stay up to date. I hate feeling left behind, our ember-try tests have been failing since April, being in this state leaves us feeling disconnected from the whole community. |
Our fairly large Ember app is facing the same issue, and this has been a blocker for the past few releases as @workmanw described. I would appreciate any information whether this issue is being worked on, otherwise we'll need to try coming up with a workaround. |
Also facing the same problems with unloading records in our enterprise ember apps and therefore stuck on ember data 2.12 :( |
Previously relationships were only cleared for new records. Now they are cleared for destroyed records as well, allowing destroyed records to be pushed back into the store and properly update their inverse relationships. [Fix #5136]
Previously relationships were only cleared for new records. Now they are cleared for destroyed records as well, allowing destroyed records to be pushed back into the store and properly update their inverse relationships. This fixes the public API for client-side delete via an adapter, see #5136.
A number of use cases rely on unloadRecord's 2.12 behaviour of treating unloadRecord as a client-side delete on the inverse side of a sync relationship. This pr restores that functionality, while retaining the invalidate+refetch functionality for async relationships. This behaviour is codified in a number of tests within tests/integration/records/unload-test.js Fix #5136, #5137
@igorT Woah, that's a nice surprise! 🙇♂️ I wonder if it fixes other issues as well. There are several closely related ones. |
@lolmaus please report issues and tag me if you're still seeing There's an outstanding issue on that PR that still needs investigating, although it's related to filtering record arrays and not relationships. |
A number of use cases rely on unloadRecord's 2.12 behaviour of treating unloadRecord as a client-side delete on the inverse side of a sync relationship. This pr restores that functionality, while retaining the invalidate+refetch functionality for async relationships. This behaviour is codified in a number of tests within tests/integration/records/unload-test.js Fix #5136, #5137 (cherry picked from commit 6e8a236)
(cherry picked from commit bbe8b41)
A number of use cases rely on unloadRecord's 2.12 behaviour of treating unloadRecord as a client-side delete on the inverse side of a sync relationship. This pr restores that functionality, while retaining the invalidate+refetch functionality for async relationships. This behaviour is codified in a number of tests within tests/integration/records/unload-test.js Fix emberjs#5136, emberjs#5137 (cherry picked from commit 6e8a236)
Unfortunately I've hit another unloadRecord bug. When I unload a record that is on the
belongsTo
side of aone-to-many
it is correctly removed from thehasMany
array. However when I push that same record back into the store, it is not added back to thehasMany
array.Ember: 2.14.1
Ember-Data: 2.14.10
Reproduction repo: workmanw/unload-relationships-bug.
Code: app/controllers/index.js.
Live example: https://workmanw.github.io/unload-relationships-bug
Failing Test: #5137
To reproduce:
You'll notice that the "All Comments" section shows the record was reloaded (re-pushed) into the store, however the relationship on the
post
is not updated to reflect this.One note here, I'm using
async: false
on this relationship. If I useasync: true
it creates a crash on unload.The text was updated successfully, but these errors were encountered: