-
-
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
[FEATURE ember-routing-bound-action-name] #3936
Conversation
Seems like this would be a breaking API change for anyone's app where a property path exists with the same name as an action if the developer used unquoted action helper paths. A safer path would be to deprecate unquoted action names and offer an opt-in to bound property paths. I am OK with either path, but want to be sure we are being true to our SemVer promise. |
@lukemelia - Good point. I am unsure if this is a common pattern (action named the same as a property), but it would certainly cause problems with this as it stands now. The change would see that a string property exists for a non-quoted action param and simply use that. Making this opt-in in would resolve this concern, at the expense of a potentially long-running flag. If that is the route we decide to go, I think we could enable the opt-in behavior via the existing feature flags by leaving the value Either way I believe that this shouldn't be a |
I'm somewhat on the fence about this change, though my objections might be picking some serious nits. This change removes one layer of indirection at the expense of adding a binding and potentially making things less refactorable. Right now, you can fire a static string action and branch within the controller/route that handles that action (or have that handler translate that action into another one that it fires). This change makes it possible to put that branching logic into a controller and have the template binding choose which action to send. If this is a common use case and surprises folk for not being in the API already, then we should add it, but it does add more code and ties this action-firing behavior to a very specific controller, which is arguably less refactorable than having a dumber template that isn't so directly tied to a controller and letting the hierarchy more fully deciding the branching logic. Picking serious nits, but figured I'd share in case it resonates. |
@machty - I agree with you in principle, but I think the issue is larger than just with the IMHO, we have options (possibly more than these though):
I am totally fine either way, and can submit another PR handling the first case while we decide on the second. |
I agree with señor Jackson. In this case, consistency trumps architecture API vinegar. — On Mon, Dec 16, 2013 at 9:13 AM, Robert Jackson notifications@github.com
|
I agree with @rjackson and @lukemelia. |
👍 @rjackson could you rebase? |
The `{{action}}` helper will now use a non-quoted parameter and perform a bound property lookup against the action's target at the time the event is triggered. If a non-quoted param is used, but the property lookup returns `undefined` a helpful assertion is made, and the specified parameter is used as a plain string action name (thus preventing this from breaking anyones applications). Also, cleans up a few unrelated non-quoted uses of `{{action}}` in the test suite.
@machty - Done! |
[FEATURE ember-routing-bound-action-name]
I think we've already done this but let's quadruple check that there's not any hangover docs that document the old unquoted way. |
I updated the website repo (just ack'ed for |
Actions can now use bound property lookup (instead of being static strings). This was added in emberjs/ember.js#3936.
After discussing this at the core team meeting, we are in favor of merging this in. However, despite publicly stating pre-1.0 that In order to ease updating, we would like to have at least one stable release before this gets merged in that warns if unquoted identifiers are used. Before this feature is merged, we know that 100% of uses of unquoted action names are incorrect. Once this gets merged in, we will be unable to disambiguate. Let's get a PR for a deprecation warning for when |
As discussed in emberjs#3936 (comment) a deprecation has been made for 1.4 (in 2ef00a2). This will enable the feature for future canary builds, as it will be enabled by default in 1.5.
This is a go for 1.4 beta |
Actions can now use bound property lookup (instead of being static strings). This was added in emberjs/ember.js#3936.
The
{{action}}
helper will now use a non-quoted parameter and perform a bound property lookup against the action's target at the time the event is triggered.If a non-quoted param is used, but the property lookup returns
undefined
a helpful assertion is made, and the specified parameter is used as a plain string action name (thus preventing this from breaking anyones applications).Also, cleans up a few unrelated non-quoted uses of
{{action}}
in the test suite.Cleaned up the website of any unquoted
{{action}}
helper usage here: emberjs/website#1149.Closes #3368.