-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ember 2.10.0 helper recompute bug #14774
Comments
Definitely seems funky, I agree. The work around for now is to ensure the recompute is done within a run-loop (which fixes the twiddle): export default Ember.Helper.extend({
count: 0,
compute() {
if (!this.timer) {
this.timer = window.setInterval(() => {
Ember.run.join(() => {
this.incrementProperty('count');
console.log('call recompute', this.get('count'));
this.recompute();
});
}, 500);
}
return "count = " + this.get('count');
}
}); Off the top of my head, I am not sure why a run-loop is required for it to function, but wrapping sets/rerenders in a |
My fault, I did not think of the runloop. Would a solution be to wrap
run.join to prevent this for future users?
|
Why is this closed? Seems like an actual bug or what's the rationale behind the need of manually wrapping |
@pixelhandler - we just hit the same issue in Ember 3.4.5. So it is still valid. We had to wrap the call to export default Helper.extend
compute: ([a, b]) ->
pendingResult = @get('_pendingResult')
if pendingResult?
@set('_pendingResult', undefined)
return pendingResult
result = a.someMethodWithNativeAwaitsInside(b)
result.then (result) =>
@set('_pendingResult', result)
@recompute()
false And this "blocked" when Any ideas? P.S. I tried creating a reproduction but couldn't do it for now. But I'm pretty sure that fixing the other issue will also fix this. |
The solution here is to ensure we |
@rwjblue - yes, this is also how we worked around the issue, but the original problem is still there. Please check the reproduction repo I've given in the other GitHub issue. |
I don't understand what you mean @boris-petrov. I'm saying that Ember.Helper's implementation of |
Ah, sorry, I thought you meant putting “run” around the “recompute” call in the user code as your initial suggestion. I misread, sorry!
But the other issue still remains.
|
I ran into this bug emberjs/ember.js#14774 so I followed the suggestion and wrapped the `recompute` in a runloop
This issue can be worked around by creating a new runloop as explained in adopted-ember-addons/ember-router-helpers#126. |
I also just ran into this, because |
Definitely a bug in the framework. We need to fix 😢. |
Easy PR right there! I'll take it tomorrow, if nobody else signs up. 😏 |
Calling recompute on a helper does not recompute in 2.10.0
Twiddle: https://ember-twiddle.com/3afc1bda1c824f4ed141b666e5521320?openFiles=helpers.my-helper.js%2C
When you change the dependency to 2.9 this code works, for 2.10 it does not work. It might be related to Glimmer update?
The text was updated successfully, but these errors were encountered: