-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[BUGFIX beta] Further cleanup of the link-to component. #12198
Conversation
88f8afc
to
4c16585
Compare
Notes:
Next things I want to do:
|
documentation-wise, I agree this is fine to leave on |
@@ -334,7 +334,7 @@ linkToTemplate.meta.revision = 'Ember@VERSION_STRING_PLACEHOLDER'; | |||
a supplied route by name. | |||
|
|||
Instances of `LinkComponent` will most likely be created through | |||
the `link-to` Handlebars helper, but properties of this class |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems weird? I don't think we use the phrase "component tag" to describe {{link-to
anywhere else. I might just reword all this.
Ember.LinkComponent
components are invoked with{{#link-to}}
. Properties
of this class can be overridden withreopen
to customize application-wide behavior.
Also change @see
below this to Ember.Templates.helpers.link-to
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed.
IMHO, these are two separate issues:
|
Hey @nathanhammond, nice work. My previous attempt is at master...ef4:link-to-cleanup. I stopped when I realized I had no public API for dealing with the triple curly case, I am happy to see it on the road to deprecation. One of my goals is to implement link-to on top of helpers that are themselves reusable, like: <a href={{url-for "posts"}} class={{if (route-is-active "posts") "active"}}>Posts</a> That would be much nicer than having people extend LinkComponent. People who want customized link behavior throughout their app can just create a standard component using these helpers, without learning any special API. A minor suggestion would be to make the helpers accept the same path & models arguments that link-to does, for ease of use, but also accept a list of models passed explicitly to handle the case where it is variable length. So both: {{url-for "person" thePerson}}
{{url-for nextRoute models=nextRouteModels}} |
@ef4 - We (actually @mmun) handled it with an AST transform for now. |
- Make it easier to extend by pulling more functionality into scope. - Removed unnecessarily imperative code. - Combine the loops for the params model deprecation search. - Make what's happening with params more explicit with comments. - Name anonymous functions. - Reword and polish documentation. - `var` => `let`
4c16585
to
f0e2b5b
Compare
This PR is set to land if everybody is okay with what I've done here. Sauce is just being flaky. Note that I've finished moving all functionality into the component and out of the hidden module scope, so re-review code. :) @rwjblue I agree that those are two separate issues, especially since I now know how they're implemented. :) @ef4 The other trick for a composable approach is making sure that I'll open additional PRs as I have time to:
|
We can amend that transform to handle the entire inline case (by converting it to block form) so that you only have to worry about the block form in your implementation. |
Seems good to me. I restarted the sauce labs job. |
[BUGFIX beta] Further cleanup of the link-to component.
I just chime in because I saw mentioned the intention to deprecate inline link-to and I was confused if that refers to the blockless |
Yes, inline link-to refers to the |
Shame, I do like that syntax. What's the reason, out of curiosity? Simplify the component? |
@cibernox - I personally do not feel strongly about deprecating and as mentioned above, I believe deprecating will have pushback. The main motivation would be complications in the component, but I think that #12229 completely allows us to remove any code in |
@rwjblue Nice approach to do as much work in compile time to make the component simpler. |
Ya, agreed. I personally have no issues with inline link-to once that lands... |
@rwjblue is correct. Supporting the positional parameter for the inline I was proposing the deprecation before @mmun mentioned that we could do it at compile time. Also, once I finish adapting @ef4's helper-based I'm still not a fan of All that said, I still want to deprecate |
No arguments here. |
var
=>let