-
-
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 {{action}} #537
Comments
Does this imply that the Event Delegation system will be removed in the same scope? |
I believe the event delegation system is also tied to deprecating classic components, since their event handler hooks also use it (that’s another upcoming pre-RFC) |
Why 5.0? Seems like a key breaking change that could be part of 4.0! Is there some threshold of removals that has already been hit for the next major version? |
This is high priority. We should fast-track an RFC draft for this. |
I believe this falls under the umbrella of #832. I'm going to close this issue to push any discussion there. Despite being closed, we will certainly use this issue for reference and to inform the future RFC. Thank you all for the discussion! |
Hi @wagenet , Just a thing I realized when migrating away from Passing for example The early error detection comes in handy when refactoring code, renaming action etc.. is there anyway that we can retain this behavior ? |
@ptgamr The undefined behavior you're referencing is in line with how JS itself works. Switching to TypeScript (Glint for Ember templates) is generally the preferred solution to avoid these situations. |
{{on}}
modifier and{{fn}}
helper{{action}}
has been a valuable helper/modifier for quite some time, but has a variety of shortcomings:this
context of a template and bind it, something that no other modifier/helper can do.click
event.passive
andonce
, that can be passed toaddEventListener
.The
{{on}}
and{{fn}}
helpers address all of these concerns, and provide a much more minimal implementation in doing so that should be easier to maintain, and cost less in terms of bundle size overall.Migration Path
Migrating to the
{{on}}
modifier should be pretty straightforward in general. The one tricky portion at the moment is an ability the{{action}}
modifier had to pick a value from events directly:The standard solution here is to have users make a custom action that handles the event. However, this is a common use case, and there likely are more ergonomic patterns out there that we can explore as a community, such as ember-set-helper. For the purposes of deprecating
action
, this RFC shouldn't block on figuring out the details of these patterns.Deprecation Timeline
Converting to
{{on}}
and{{fn}}
is not automatable, so it will probably take some time for us to convert as a community. Given how prevalent the{{action}}
helper/modifier is, extending the deprecation timeline to v5 makes the most sense at this time.The text was updated successfully, but these errors were encountered: