waitForProperty never yielded when used when @tracked property changes
See original GitHub issueI’m not entirely sure if this is an e-c bug or an issue with Octane Edition, but combining waitForProperty
with a @tracked
property doesn’t work.
export default class SomeService extends Service {
@tracked someProperty = false;
@task(function *() {
yield waitForProperty(this, 'someProperty');
// this code is unreached even if `someProperty`
// becomes true.
}) aTaskThatWaits
}
This appears to be caused by the various waitFor{*}
s being based on addObserver.
Although I’d assume backwards interop at the EmberObject
level to not break SemVer in Ember.js itself.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Tracked Properties - Octane Upgrade Guide - Ember Guides
Ember's classic change tracking system used two methods to ensure that all data was accessed properly and updated correctly: get and set ....
Read more >Ember component is rendering the number of time the tracked ...
I passed the isPlaying property from the component-class and I'm logging it to the console. Instead of logging the the value of isPlaying...
Read more >Silk Test 18.5 - Micro Focus
Unless you are using a trial version, Silk Test requires a license. Note: A Silk Test license is bound to a specific version...
Read more >eggPlant Release Notes - TestPlant - Yumpu
Use the copy file… to … syntax with sut: before the filename to indicate a ... Changed the add properties command and adding...
Read more >Ember.js Octane vs Classic Cheat Sheet
Angle brackets components can be used as either inline or block components. There's no change in behavior. {{yield}} looks and works the same....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@trek @rwjblue @maxfierke I got the same error and found that it happens because https://github.com/machty/ember-concurrency/blob/d6b30e8b55c18b1e3da97d880c7ef612a5168aab/addon/-wait-for.js#L96 here we are trying to call missing
addObserver
/removeObserver
methods If I add those 2 missing methods everything works fine with@tracked
@trekSo I believe everything can be fixed with exported add/removeObserver methods
Similarly I have found
waitForProperty()
to be unreliable for observing state derived from@tracked
properties. It seems however that this isn’t an issue with EC itself but rather with Ember’saddObserver()
. We are refactoring away from using EC as much as possible as a result, which is quite a shame as we had some good patterns going.