-
-
Notifications
You must be signed in to change notification settings - Fork 114
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
[Bug Ember 3.15.0+] Creating a tracked model with a fragment array throws back-tracking assertions #357
Comments
I created a corresponding issue in the ember.js repo too emberjs/ember.js#18773 |
Just posting an update here. There was a bug on the Ember.js side and that was resolved but according to @pzuraq there are still some problems with Ember Data Model Fragment's implementation when setting up fragmentArrays. See the comment here emberjs/ember.js#18773 (comment)
I've followed up and I think the best approach here would be to refactor the code where fragmentArrays are setup, possibly have a separate codepath for initializing versus setup? I had an initial go at a refactor but it appears quite tricky, there seems to be quite a bit of historical usages and edge cases accounted for. @jakesjews @slindberg @workmanw would anyone be up for a chat to talk about the right path forward here? I'd be happy to work on it. |
@patocallaghan I've been sick the last few days but I can chat more after I'm better. I think it's ok to make some breaking changes in a new major version release if need be. I took over maintenance on this after the original author moved on so a lot of the historical usage is unknown to me as well. |
Sounds great @jakesjews. Let me know when you'd like to chat 👍 |
What's the status on this issue? |
@knownasilya myself and a colleague spiked a fix which resolved the initial test case I'd created but it didn't totally solve the issue as we got backtracking assertions in other parts of the code. Due to the ongoing overhaul of the internals of model-fragments to use recordData and the rerenders coming from code which is currently being changed, it didn't feel like a good use of our time to try refactor further until that lands. |
Has this issue been resolved?
|
That's so weird it works, if I call a second time the fragment array... |
Ok, for the record, I just found out this error happens only if my model becomes dirty BEFORE I ever accessed (via computed or whatever) to the fragment array... When the fragment array is created via setupData, Am I doing something wrong? I'm working with ember |
What is really strange is that propertyWasReset(internalModel, name) {
if (!internalModel.hasChangedAttributes()) {
internalModel.send('rolledBack');
}
}, calls I replaced it by a dummy implementation like: hasChangedAttributes() {
return Object.keys(this.changedAttributes()).length;
} and now the error disappeared as What should we do? |
@GuillaumeCisco I wonder if you could create a failing test for the issue you are seeing? Looking at the open issues there are few which look to be related to |
Thank you @patocallaghan, I will do my best the moment I have enough time on that. |
Is this project dead? Should I fork it if I want to use it? |
@GuillaumeCisco we're currently moving ownership to ember-adopted-addons |
Fixed in v6.0.1 |
I'm currently trying to upgrade our app from ember-source 3.14.x to 3.15.x and I've found a blocker which is preventing our upgrade.
From ember-source 3.15.0-beta.4 it appears that tracked models which have properties using
fragmentArray
will throw a backtracking rerender assertion causing things to blow up.There are two suspect commits in ember-source where this was introduced.
I've created an extremely simplified test case in #358 and it throws the following assertion:
The problem appears to happen in the following lines, specifically 298 (where the array is created) and 300 (where the array is updated) https://github.com/lytics/ember-data-model-fragments/blob/c00e2b1a40b296e0c0c3c21ca0f463d12888cd27/addon/attributes.js#L298-L300
The array is first set up in
createArray
athttps://github.com/lytics/ember-data-model-fragments/blob/c00e2b1a40b296e0c0c3c21ca0f463d12888cd27/addon/attributes.js#L195-L208
the array is modified a second time in
https://github.com/lytics/ember-data-model-fragments/blob/f1c7060fb7560aaea26760e0270234823b9e20db/addon/array/stateful.js#L79
While in my test reproduction I am specifically marking the property as
@tracked
The text was updated successfully, but these errors were encountered: