Who designed the Ember Js logo

Ember.js: Support of the "Target" option for closing actions

Law. I fully understand that there is an inconsistency between element space action and closure actions in relation to. It's not the only inconsistency (for example, closing actions aren't bubbling up) and it might appear unintentional. I agree that the silent bug case we have today where a developer might migrate from an Element Space Action to a Closing Action and where pasta copies expect consistent behavior but don't get it is less than ideal and Can be improved.

However, I strongly believe that the use case described above (addressing methods for a model) is an anti-pattern when developing Ember apps. In this light, the behavior of classic actions can be viewed as a bug, and I don't want to propagate that behavior into closing actions. In the medium term, element room actions in Ember will be outdated and removed in the long term. However, the closing action API remains with Ember for a long time. Let's only bring what we want.

There is no documentation to suggest that

Of the three with @rwjblue Linked documentation snippet implies only one that is used as the context for the job evaluation. However, the sample code uses a string action name and not a function. I am not aware of any documentation that describes a context argument for passed functions.

In fact, the documentation explicitly states what does in the intro:

  • will be on instead of the current one
    Context for the hash. This can be useful when targeting a
    Service for promotions.

It will look for the hash. Do not call any function with the context.

Why avoidance is an anti-pattern

Many experienced developers resent the design in Ember. I fully agree that the ergonomics are not optimal, however they can be improved over time and the design serves a purpose.

The common foot weapon is supposed to help with a conflict between template-related actions and lifecycle hooks. For example:

If defined, there is no way to determine whether a user inadvertently used a method name that conflicts with a hook, or whether they intended to subordinate this behavior. What was the goal in the code above? Override the lifecycle hook or add an action?

If a context is allowed to create, the above method can be called with:

Not only did the user fall into a trap where we can prevent them from falling (he stomps), but they also had to enter twice. Since this can be a service or something with a complex name, it only invites typos and reduces readability to encourage it.

Compare this to the action system that works today:

This had no repetition and does not conflict with the model's lifecycle hook ().

For measures to work well, the framework must support them at all times. Even though there are cases in which passing a context works safely, we need something robust against known error cases. We want all apps to expose the API for templates.

But the ergonomics sucks

I agree that seems out of date. I am assuming that once ES classes are supported, we will want to use decorators. For example:

A decorator would allow us to state that the user has not fallen victim to an ordinary foot weapon. For example, we can check if there isn't a method with the name in the superclass, or if there is a method in the superclass that also has one (actions can only override actions). In the above case, since it is actually defined in the chain, we can claim that an action is stomping a lifecycle hook and notify the user accordingly.

Once this system is in place, actions can also create deals with their context. Since the context is packed into the action, there is no need to specify a context. This removes the duplication, and then addresses a method in the model. I think would be feasible at this point. Perhaps the helper himself is not needed.

I think we can and will improve this, but I don't want to encourage developers to do anything other than the current ones as they are designed today.

What I think we should do

I am not suggesting that nothing should be done. There's definitely a subtle inconsistency between that
two APIs and we can improve the failure mode.

  • On closing actions, which are raw functions passed in (I believe here?), We should claim that also will, suggesting that the user is using string actions instead.
  • If there is an implicit context of in closing actions (which I can't refer to exactly when scanning the code but I believe because others triggered it) we should change that to. always. When the method completes, it continues to evaluate as expected. A change in behavior is only found in the implicit cases.