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.

Having a Computed Property (CP) which depends on a oneWay CP doesn't work

See original GitHub issue

Here is a twiddle which demonstrates the issue https://ember-twiddle.com/1934386ad97e960cac37b36cf0068847?openFiles=templates.my-route.hbs%2C&route=%2Fmy-route

The controller has three CPs,

customRoutingType: oneWay('model.customRoutingType'),
isFixedRouted: equal('customRoutingType', 'fixed').volatile().readOnly(),
isDynamicRouted: equal('customRoutingType', 'dynamic').volatile().readOnly()

customRoutingType can take the values fixed & dynamic based on which radio button you click when you visit the my-route route in the twiddle

The route template displays the state of the three values. customRoutingType updates as you toggle the radio buttons, but the other dependent CPs do not.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
luxzeitloscommented, Oct 4, 2018

Related SO Question

It also is correctly explained in the API specification:

It also does not automatically fire any change events. You must manually notify any changes if you want to observe this property.

Dependency keys have no effect on volatile properties as they are for cache invalidation and notification when cached value is invalidated.

0reactions
leondmellocommented, Oct 4, 2018

I guess this can be safely withdrawn then 😃 Thanks everyone for the explanations

Read more comments on GitHub >

github_iconTop Results From Across the Web

Computed properties dependent on async relationships do ...
A computed property dependent upon an async relationship does not recompute when the relationship fulfills. In the reproduction, post hasMany (async) ...
Read more >
Help refactoring a no-side-effects warning in a CP - Ember.JS
The warning is generated because you're using a computed property (which is supposed to have one-way data flow, e.g. reads the values of...
Read more >
Ember js @each one level deep but I have a two deep level ...
This can be achieved with a chain of computed properties, where each property has only one @each level. Say, you have Foo, Bar...
Read more >
Vue: When a computed property can be the wrong tool
sortedList depends on isOver100 though - so it also has to be marked dirty. And likewise, it won't yet be re-evaluated because that...
Read more >
Fastest and safest way to copy massive data from one external ...
Fastest and safest way to copy massive data from one external drive to another · 1. Starting with MacOS 10.13. · The answer...
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