You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I create a new subProject, then save it, then save the project, so that all data and relations are saved.
Id I do the opposite ( save project, then save subProject ), then the sub-project new sub project get added twice, until I reload
Looking at the code of many-array, I can see why it is doing that :
flushCanonical: functionflushCanonical(){//TODO make this smarter, currently its plenty stupidvartoSet=this.canonicalState.filter(function(internalModel){return!internalModel.isDeleted();});//a hack for not removing new records//TODO remove once we have proper diffingvarnewRecords=this.currentState.filter(function(internalModel){returninternalModel.isNew();});toSet=toSet.concat(newRecords);varoldLength=this.length;this.arrayContentWillChange(0,this.length,toSet.length);this.set('length',toSet.length);this.currentState=toSet;this.arrayContentDidChange(0,oldLength,this.length);//TODO Figure out to notify only on additions and maybe only if unloadedthis.relationship.notifyHasManyChanged();this.record.updateRecordArrays();},
So here is my problem :
reload
Looking at the code of many-array, I can see why it is doing that :
The problems occurs with
The record is already in the relation, and get added again because it was not saved. Canonical state is fine, but the currentState is not.
I think I can try to fix that, if it is OK ?
The text was updated successfully, but these errors were encountered: