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

ember-data 2.14.0: Assertion Failed: You modified "model.players" twice on ... in a single render. #5017

Closed
ghost opened this issue Jun 18, 2017 · 7 comments · Fixed by #5119

Comments

@ghost
Copy link

ghost commented Jun 18, 2017

Just updating ember-data to 2.14.0 from 2.13.1 I have this following error.

NodeJs 7.10.0 - npm 5.0.3

Assertion Failed: You modified "model.players" twice on <myapp@model:team::ember767:1> in a single render. It was rendered in "template:myapp/templates/team.hbs" and modified in "template:myapp/templates/team.hbs". This was unreliable and slow in Ember 1.x and is no longer supported. See https://github.com/emberjs/ember.js/issues/13948 for more details.
Error
    at assert (http://localhost:4200/assets/vendor.js:18622:13)
    at Object.assert (http://localhost:4200/assets/vendor.js:18835:34)
    at http://localhost:4200/assets/vendor.js:35859:27
    at runInDebug (http://localhost:4200/assets/vendor.js:18735:5)
    at Object.runInDebug (http://localhost:4200/assets/vendor.js:18859:38)
    at Object.assertNotRendered (http://localhost:4200/assets/vendor.js:35833:23)
    at Object.propertyDidChange (http://localhost:4200/assets/vendor.js:34476:30)
    at Class.propertyDidChange (http://localhost:4200/assets/vendor.js:47793:19)
    at Class.notifyPropertyChange (http://localhost:4200/assets/vendor.js:47807:12)
    at InternalModel.notifyPropertyChange (http://localhost:4200/assets/vendor.js:79047:20)
defaultDispatch @ ember.debug.js:19818
dispatchError @ ember.debug.js:19797
invokeWithOnError @ ember.debug.js:2200
flush @ ember.debug.js:2256
flush @ ember.debug.js:2380
end @ ember.debug.js:2450
(anonymous) @ ember.debug.js:3016

My package.json:

"broccoli-asset-rev": "^2.5.0",
"ember-ajax": "^3.0.0",
"ember-cli": "2.13.2",
"ember-cli-app-version": "^3.0.0",
"ember-cli-babel": "^6.4.1",
"ember-cli-babili": "^0.2.0",
"ember-cli-code-coverage": "^0.3.12",
"ember-cli-dependency-checker": "^2.0.0",
"ember-cli-deploy": "^1.0.1",
"ember-cli-eslint": "^3.1.0",
"ember-cli-htmlbars": "^2.0.2",
"ember-cli-htmlbars-inline-precompile": "^0.4.3",
"ember-cli-inject-live-reload": "^1.6.1",
"ember-cli-qunit": "^4.0.0",
"ember-cli-sass": "^6.2.0",
"ember-cli-shims": "^1.1.0",
"ember-cli-sri": "^2.1.1",
"ember-data": "2.14.0",
"ember-export-application-global": "^2.0.0",
"ember-load-initializers": "^1.0.0",
"ember-resolver": "^4.1.0",
"ember-responsive": "^2.0.4",
"ember-simple-auth": "^1.3.0",
"ember-source": "~2.13.3",
"loader.js": "^4.5.0",
"run-sequence": "~1.2.2"

team.hbs:

{{#each model.players key="id" as |player index|}}
  <a href="[somerUrl]" class="{{player.statusClass}}">
    <span>{{player.code}}</span>
    {{#if player.isOk}}
      {{#each player.fighters.content as |fighter|}}
        <div class="fighter {{fighter.fighterClass}}">{{fighter.fighterText}}</div>
      {{/each}}
    {{/if}}
  </a>
  {{else}}
  {{#if model.players.isPending}}
    Loading...
  {{else}}
    Nothing to show.
  {{/if}}
{{/each}}

Why this error?

@runspired
Copy link
Contributor

You are likely either loading data twice in the same render or mutating that data within the same render. I would suggest asking for help on Slack.

@ghost
Copy link
Author

ghost commented Jun 19, 2017

Yes, but I don't understand where. And with ember-data 2.13.1 it works good.

@sly7-7
Copy link
Contributor

sly7-7 commented Jun 20, 2017

I encounter exactly the same symptoms switching from 2.13.x to 2.14.x. I did'nt have the time to dig in further now, but I will do asap.

@workmanw
Copy link

I also saw something similar when running ember-try with 2.14, but we're still stuck on 2.12 until #4986 is fixed up, so I didn't bother to dive in too deeply. It's definitely possible we're doing something goofy that just happened to work before and a change in 2.14 exposed it.

@BryanCrotaz
Copy link
Contributor

I have this with a vanilla adapter and serialiser generating jsonapi from a non standard json backend. Just overriding normalise and using store.find

@tschoartschi
Copy link

I have the same problem. And like @johnunclesam I don't get it where I try to load the data twice... There is also another issue which looks very similar: #4942 not sure if it is an issue with my/our code or an issue with ember-data. Maybe someone has an idea how to debug this problem. I'm pretty much lost in the huge stacktrace.

@nerdyworm
Copy link

Same issue. Although #4942 looks like it is the root of the issue.

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

Successfully merging a pull request may close this issue.

6 participants