ember-cli-copyable
ember-cli-copyable copied to clipboard
Deep copy browser stuck
Hi,
My browser becomes stuck with 100% CPU usage on object copy:
This is my action:
actions: {
selectSurvey(id, component) {
let store = this.store;
let campaign = this.get('model');
campaign.get('survey').then(function(survey) {
if (survey)
survey.destroyRecord();
store.find('survey', id).then(function(survey) {
survey.copy().then(function(copy) {});
});
});
},
}
The survey model is copyable and has many questions (copyable too) with many answers (copyable again). Maybe an infinite loop in deep copy ?
The problem occurred only on survey with questions. Copy for a survey without questions works fine.
Ember-cli: 2.3.0
Ember-cli-copyable: 0.9.6
Any idea ?
@spuyet I had the similar issue, it's obviously - infinite loop cycle.
You might have relation in your Question or Answer model to survey or to it's predcessor in hierarchical chain: Question has belongsTo relation to Survey
or
Answer has relation to either Question or Survey
I think I'm suffering from this too. To use the example that @Blackening999 is suggesting, in my model I have a Survey
model with questions: hasMany()
, and a Question
model with survey: belongsTo()
. Attempting to clone a Survey
instance results in an infinite loop.
It seems that PR #17 may be the solution - could it please get merged in?
Same here, +1 to #17 merge