link-to assertion fail: property modified twice in a single render
See original GitHub issueember-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 thelink-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:
- Created 4 years ago
- Reactions:1
- Comments:8 (5 by maintainers)
Top GitHub Comments
Just noting this here, we also ran into this and were able to workaround this by passing the argument as readonly:
It’s not ideal, but at least it works!
Looking into ember-router-helpers as a possible workaround… comes with a couple of caveats though:
That addon does not seem to support engines, so you have to use fully formed paths (and they generate full-app page loads)
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: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.