Skip to content
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 positional arguments and non-block usage of {{link-to}} #614

Closed
chancancode opened this issue Apr 11, 2020 · 3 comments · Fixed by #698
Closed

Deprecate positional arguments and non-block usage of {{link-to}} #614

chancancode opened this issue Apr 11, 2020 · 3 comments · Fixed by #698
Labels
T-framework RFCs that impact the ember.js library

Comments

@chancancode
Copy link
Member

chancancode commented Apr 11, 2020

In #311 we added official named arguments to {{link-to}} (and therefore making <LinkTo> possible). Now that people have had time to migrate (and there are codemods available), it is time to kill the positional arguments api for {{link-to}}.

Reasons:

  1. It's no longer idiomatic, as it is being taught as a component, and components largely don't take positional arguments anymore due to widespread angle-bracket invocation usage (unless they are mimicking "control flows", which {{link-to}} is not)
  2. The positional argument version and the non-block version are implemented via magic AST transforms, making it not "just a regular ember component" and not importable

It would be nice the get on this asap so the deprecation can land before strict mode (#496) lands in a stable release. Otherwise, we will end up in a situation where the "normal" version of <LinkTo> requires an import but the "legacy" form {{link-to}} does not. That will be a while, so we have some time, but still we should start soon.

I would expect that this should also deprecate (query-params) as it is not necessary using the named arguments version.

To be clear, {{#link-to route=... model=...}}...{{/link-to}} would still work, because you can invoke any components with either curly or angle bracket form, but it's the positional arguments mapping that we are talking about here.

@chancancode chancancode added Seeking Co-author T-framework RFCs that impact the ember.js library labels Apr 11, 2020
@Gaurav0
Copy link
Contributor

Gaurav0 commented Apr 11, 2020

It would seem to me we should wait until we can deprecate curly invocation of link-to rather than making people change their templates twice?

@chancancode
Copy link
Member Author

chancancode commented Apr 12, 2020

@Gaurav0 Curly invocation of link-to is not going away because curly invocation of components are not going away. Perhaps it will happen some day, but it's not on anyone's radar, as far as I know. There are some good use cases for recommending curly invocations for your components, in particular, ones that are mimicking "control-flow", such as {{#animated-if}} or {{#async-await}}. But {{#link-to}} is not one of them, and it's definitely more idiomatic to invoke it with angle brackets. The recommended path for this deprecation would be to recommend switching to the angle bracket form (rather than keeping the curly invocation but switching to named arguments there), so there are no need to migrate twice here.

@chancancode
Copy link
Member Author

#698

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-framework RFCs that impact the ember.js library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants