-
-
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
Intent to RFC: Deprecate Computed Properties #536
Comments
Depending on the timelines, we might be able to make these an optional feature installed by default at a 4.0.0 release; alternatively, we should aim to take advantage of the various tree-shaking/svelte-ing approaches outlined in #532. Either way, we should ensure that if people are able to switch entirely, they stop paying for these in bundle size. |
Yup! That’s the point of svelte flags, definitely 😄 They give us a standardized way for users to opt out of large deprecated features, so we don’t need to worry about the details for each deprecation RFC |
My comment is that it is too soon to give comments on this. Until I'm able to migrate to all the octane stuff in my app I just don't know yet if there are still uses for computed properties, if the new programming model holds up, etc. I'm worried this may go the same was as proposing the deprecation of controllers i.e. adding a lot of questions for new users, but not actually being possible because of deep underlying complexity in removing them. |
Totally understand the hesitance, especially since we have previously tried to push forward as a community without fully replacing a concept (like with Controllers and Query Params). I do think computed properties are different for two reasons:
Between these two points, I'm personally pretty confident that all use cases for CPs have been covered. There's a reason why the deprecation period here is 2 major versions in the future though, which is to give us time in case we do encounter issues or missing use cases along the way. |
I'm all about this deprecation RFCs. My question is about the target, why v5? Is it necessary to keep compatibility/bloat until then? |
I think mostly because for many long-lived apps, deprecating in v4 is too aggressive a timeline. deprecating for removal in v5 gives all the apps that have been in development since 8 years ago time to catch up. Also, I believe there is work happening to allow you to opt in to deprecated features to be removed, since you (and me) like to stay ahead of / on the curve / edge. :) |
It depends on the timeline for 4.0. If 4.0 is in three months, yeah, it's too aggressive. If it's sometime in 2021, well… probably not. 😆 This is definitely a pre-RFC for that reason. |
Despite this being inactive, it seems important enough that I'm going to leave it open. We should find a way to fast-track the generation of RFCs for this type of deprecation. |
Agreed. It’ll be covered in the output of #832, but as with observers we can split it out if that proves expedient. |
I’ll close for now and we can reopen if beneficial. |
macro-decorators
Computed properties have been an Ember mainstay since the beginning of the framework. They were how Ember accomplished reactivity, and they have been incredibly useful for deriving state in a declarative way. Tracked properties iterate on CPs, giving us the same benefits with less boilerplate and more flexibility. CPs add a large amount of complexity to the framework overall, and a hefty chunk of code, so removing them will be a major win from a maintenance perspective and a bundle size perspective.
Migration Path
For the most part, migrations from CPs to TPs should be pretty straightforward. There will be gotchas, particularly around caching since getters for TPs do not cache. We should make sure we have lots of guides showing users how to migrate, and how to debug tracked properties (especially in cases of infinite rerenders/invalidations).
Part of deprecating CPs also includes deprecating CP macros, such as
@and()
,@or()
,@filter()
,@alias
, etc. These macros were very useful prior to TPs because they allowed users to avoid a large amount of boilerplate, but since the boilerplate has been reduced so much with TPs, they may not make much sense in most cases anymore. They also represent a fair amount of bundle size, and a decent maintenance burden.This pre-RFC proposes that Ember should not continue to provide computed property macros. Since any getter should work with tracked properties, users can instead rely on a generic decorator libraries, like
macro-decorators
. These libraries don't need to be Ember specific, or maintained by the Ember core team, and can instead be community driven. This would also allow them to experiment much more (similar toember-macro-helpers
), without relying on private APIs or causing additional issues down line since it's Just JavaScript™️.Deprecation Timeline
Computed properties are highly prolific in Ember code today, so it will take quite some time for users to migrate from them. This is why this pre-RFC proposes that we deprecate them for removal in v5.0.0, which should give the community plenty of time to adopt the new idioms and migrate away from CPs.
The text was updated successfully, but these errors were encountered: