-
-
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
[BUGFIX beta] Fix unloadAll to also unload live records #5350
Conversation
there's now an additional "updated" event when the record is unloaded during tear-down of the test suite
# Conflicts: # tests/integration/records/unload-test.js
@@ -76,6 +76,13 @@ export default class RecordArrayManager { | |||
this.internalModelDidChange(internalModel); | |||
} | |||
|
|||
recordWasUnloaded(internalModel) { | |||
let array = this._liveRecordArrays[internalModel.modelName]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dwickern Since array
isn't changing, maybe it's best to use const
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was to match the existing code style
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. 👍
LGTM, bu @hjdivad could you review this please ? |
I will look into this issue and review this PR as part of #5378. I suspect the underlying issue is a combination of one we have already fixed with the issue seen in |
@runspired the test in this PR fails against your branch |
I dug in and while this fix appears to work it does not address an underlying issue:
|
The issue appears to be that records need to have been accessed to be unloaded correctly. |
I found the underlying issue and resolved it here: 55fd924 Thanks for the failing test and fix attempt, it was extremely helpful in narrowing in on the root cause. |
unloadAll
should also unload records which were fetched usingfindAll
. Currently the unloaded records are destroyed but the record array isn't cleared. So callingfindAll
a second time after unloading will return the destroyed records and fresh ones (potentially duplicates of the destroyed records).