-
-
Notifications
You must be signed in to change notification settings - Fork 407
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 {{mut}} #538
Comments
agree with the 5.x timeline. This was the prescribed way for a while, and having migrated off some of the old one way controls recently to this, just to have to do another one due to the shifting prescribed behaviors would be tedious. |
I would prefer it if we offered a built-in ergonomic alternative before deprecating the existing solution. A lot of codebases are using |
@Turbo87 ember-set-helper could be that ergonomic alternative. |
@balinterdi yes, but IMHO we should try out that addon, see if it can be that alternative, if it works pull it into core and then deprecate |
|
@Turbo87 - Ya, I think this is reasonable. |
I definitely understand the worry here, this is a very common pattern and it will be painful to migrate for heavy users. If we didn't have the ability to design and build solutions in userland at all, I would definitely agree. The reason I'm a bit more aggressive here is, I was actually just discussing this in Discord with @balinterdi, where he was planning on using Historically, we had other cases where this happened, like observers. But in those cases, userland solutions were not possible - here, it is. So, we could move a bit faster, and possibly prevent more damage from users adopting the antipattern. Alternatively, maybe we could create a new type of warning system, like a pre-deprecation system that users could opt out of. The main thing I personally don't want to gate on is having a solution in core, because I believe this will both disincentivize experimentation, and cause more damage to the ecosystem. (Edit: I do think waiting for v4 and extending the deprecation to v5 would be fine though too) |
To the point of
The first I've heard that it was a "known antipattern", and "actively discouraged by core" was just a few months ago during a conversation about using the built in "input helpers". For a definite set time (at least from my understanding) the preferred default way to deal with form controls was to use |
@webark precisely, that's actually the main issue here IMO. Every time communicating this would come up in conversation, it would inevitably get push back because "we don't have an alternative yet", and then because we couldn't agree on alternatives. Add to this that there hasn't been any experimentation in addon space for us to test out, and it really becomes a difficult chicken-and-egg situation. I just checked and realized it's actually still in the mainline guides, which is really disappointing 🙁 I definitely think we should remove it for Octane's guides at least. Given the conversation here I'm going to update the pre-RFC to suggest v5 as the timeline instead, definitely think it will take longer than we'd hoped to get off of this helper. |
To second @webark, I also only recently learned that And I only learned this week that its use is actively discouraged. The currying behavior has always been funky and I've found it difficult to teach. My main issue, however, is the inconsistent behavior that Chris describes in the very first sentence:
With some idioms landing in stable Ember (notably |
FWIW I converted the book's examples to use the |
Just published ember-simple-set-helper as another, much more direct alternative to I definitely encourage others to experiment here as well - I think the baseline is something that's basically the same as |
After much discussion and deliberation, I'm closing this issue since it turns out that there is not as much consensus around the future of Thanks to everyone for commenting and discussing, the community's feedback was invaluable here, it really got us talking on the core team and helped us to clear some things up! |
mut
is a very confusing helper. If you pass it down directly, it gives you the value it references, but if you give it to the{{action}}
helper, it turns into a setter that updates that value.In addition, the fact that you have to curry values after the helper is generally a sticking point in teaching users how to use it:
The
mut
helper has been considered not to be the best practice for some time now, and removing it from the framework will help to prevent confusion in the future.Migration Path
The official recommendation for replacing
mut
will be to manually write actions which update values:This is a fair amount more boilerplate, but given the confusing nature of the
mut
helper, it is less likely to cause issues in the long run in existing applications.Since this is not the most ergonomic solution, we do expect there to be experimentation with better patterns in the ecosystem - ember-set-helper is an example of one such possibility, and others are absolutely encouraged. In time, we can RFC a better helper or pattern into the core of Ember.
Deprecation Timeline
mut
has not been considered best practice for some time, but its usage is not uncommon in the ecosystem, and users who do use it appear to use it heavily. There also are not many existing alternatives in the addon ecosystem, so it's better to give a longer timeline for the ecosystem to adapt. Ideally, we'll be able to introduce a direct alternative beforemut
is fully removed.The text was updated successfully, but these errors were encountered: