Render and modified error message [solved]

On ember 3.4 I have the following error :

“Assertion Failed: You modified “sp.produit” twice on <marketadmin@model:shared-produit::ember483:10> in a single render. It was rendered in “component:shared-produits/catalog-line” and modified in “component:shared-produits/catalog-line”. This was unreliable and slow in Ember 1.x and is no longer supported. See [Glimmer 2] "Backtracking re-render" is now an assertion · Issue #13948 · emberjs/ember.js · GitHub for more details.”

This is the component (the JS has a tagname:'tr' as it’s single property)

<td>{{sp.produit.nom}} </td>

How it is used :

      {{#each model as |sp|}}
        {{shared-produits/catalog-line sp=sp}}

And the model :

    return this.get('store').query('shared-produit',assign(params,{include:'owner,produit'}))

The error happen when I refresh the page, and It display only the first 3 lines with all the cells correctly populated. If I naviguate to another route an browse back without reloading to the same page, it display the full table without console error except that the 3rd line and the 9th lines are blank (the third line was not blank when there was the error).

How can I fix this error.

Ok, I managed to find more specifically what is triggering the error. This page display a list of shared_produit. A produit can have 2 relation to a share_produit

  shared_produit: DS.belongsTo('shared_produit'),  // server side it's a has_one relation
  shared_from: DS.belongsTo('shared_produit',{inverse:'from_share_produits'}),

Only one relation at a time can exist. If a produit has a shared_produit relation, it means it is shared for others to resell. If it has a share_from relation, it means it is shared from a parent product.

Obviously, this circular relation (that never happen) is causing this problem. I am not sure how to fix it.

Ok server side I had some data breaking th 1:1 relationship, and each line where it was breaking the constraint the relation was reassigned thus explaining the modifications.

1 Like