-
-
Notifications
You must be signed in to change notification settings - Fork 408
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
Deprecate recompute
on Helper
?
#633
Comments
I think it is a tad difficult to suggest "just use Either way, I agree with this direction. My point above is that we should probably tie this deprecation to land no earlier than 3.21, at which point 3.12 will no longer be an active concern (since 3.16 and 3.20 would be the active LTS versions). Note: 3.21 is current ember-source master, so this is still a great time to push this forward. 😄 |
What a time to be alive 😄 |
We discussed this again today at the framework meeting. As the tracked system is now very, very common, this proposal is definitely ready for RFC and advancement. |
@mixonic who will write the RFC? |
Should this be considered with #832 or separately? |
The point of the
recompute
method is that you call it to trigger Ember to re-render the helper in some kind of callback, such as observers, promise callbacks, etc.Since helpers are now auto-tracked, it should be possible to refactor any usage of
recompute
into setting tracked state and accomplish the same thing. In most cases, the transformation is pretty straightforward.Before:
After:
The example uses an observer, because that is a common kind of callback used in this position, but it's ultimately unrelated to my point.I also think there are better ways to accomplish the same thing without using observers, in general, but that is also besides the point here.
For prosperity, here is a second example that doesn't use observers:
Before:
After:
The general pattern is: instead of calling
recompute()
, just refactor into setting a piece of tracked state and use that tracked state in thecompute()
method.Would be interested to see if there are any valid use cases this doesn't cover.
The text was updated successfully, but these errors were encountered: