question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

link-to assertion fail: property modified twice in a single render

See original GitHub issue

ember-source: from 3.10.0 to 3.10.2 (I haven’t tried with other versions) ember-engines: from 0.7.2 to 0.8.2

Linking a property from a component or a controller to the @route of a <LinkTo> tag throws an assertion failed:

Assertion Failed: You modified “url” twice on [object Object] in a single render. It was rendered in “component:link-to” and modified in “component:link-to”. 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.

This wasn’t an issue in prior versions of ember-engines.

Way to reproduce the error:

  • create a new project
  • add ember-engines 0.7.2
  • create an in-repo-engine
  • create an application controller inside the engine
  • create a string property with value index (for example test)
  • add a link-to component to the application.hbs (angle brackets or not)
  • add this.test as route for the link-to component
  • run the application

When visiting the application route of the engine, it will throw the exception. I don’t know if it can be relevant, but logging the property passed to the link-to component in the devtools, I saw that instead of being just the string index, link-to transforms it into a getter/setter.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
mydeacommented, Aug 6, 2019

Just noting this here, we also ran into this and were able to workaround this by passing the argument as readonly:

<LinkTo @route={{readonly this.dynamicRouteName}}>

It’s not ideal, but at least it works!

2reactions
thec0kemancommented, Aug 5, 2019

Looking into ember-router-helpers as a possible workaround… comes with a couple of caveats though:

  1. That addon does not seem to support engines, so you have to use fully formed paths (and they generate full-app page loads)

  2. Our engines have a lot of link-to’s… so this will be tedious.

The interesting thing is I think this is mostly tied to passing a bound attribute into the path property. So for example, when using the unbound helper to wrap the value:

= link-to (unbound myObject.path)

Then everything works. So it seems like the major issue here is when you pass bound objects into link-to, and ember-engines tries to prefix the engine name.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ember.js - Assertion failed: you modified <computed var> twice
Ember.js issues an "Assertion Failed: You modified computedTotal twice on <iec-jbe@component:order-form::ember906> in a single render ...
Read more >
Assertion Failed: You modified"abc" twice - Ember.JS
It was rendered in “component:column” and modified in “component:protection/protection-schedule”. This was unreliable and slow in Ember 1.
Read more >
[Solved]-You modified *** twice in a single render-ember.js
Basically, your resultCount is a temporary variable that we can get rid of, and the rest are just chaining computed properties together:.
Read more >
LUX - What ember means by "modified twice in a single render"
Sometimes when working with ember people encounter a message like this one: Uncaught Error: Assertion Failed: You modified "tabs.length" twice on ...
Read more >
The 8 Most Common Mistakes That Ember.js Developers Make
One of them is using the link-to helper from templates. ... Routes in Ember.js set up properties on controllers that serve as the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found