Skip to content
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

Deep copy browser stuck #19

Open
spuyet opened this issue Mar 25, 2016 · 3 comments
Open

Deep copy browser stuck #19

spuyet opened this issue Mar 25, 2016 · 3 comments

Comments

@spuyet
Copy link

spuyet commented Mar 25, 2016

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 ?

@Blackening999
Copy link

@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

@stevesims
Copy link

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?

@Cottonwoods
Copy link

Same here, +1 to #17 merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants