You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fn helper does not partially apply arguments #17959
I’ve noticed that the new fn helper does partially apply the arguments of combined fn calls. I’ve set up a sandbox to demonstrate (be sure to open your browser console): https://codesandbox.io/s/wnkp6m7mww (It’s worth noting that the ember-on-modifier modifier addon is not working with this sandbox (unsure why), so I'm falling back to an onclick handler). I expected the handler to recieve arguments of both fn calls, similar to how the action handle applys arguments. Instead the second argument is undefined.
The RFC was not updated to explicitly cover this use case and states that fn is essentially just essentially calling this.passedMethod.call(…arguments);, which wouldn’t necessarily result in the argument application behavior that the action helper provides. It's possible that this is the intended functionality, however, after some Discord discussion, it seems that this may be a bug that warrants some investigation.
Here's a sandbox with a more realistic example (again, be sure to open your console): https://codesandbox.io/s/2x9wyyqjxj I’ve intentionally left the Stars component very generic. That is, I’m not passing a movie ID in as a component argument; this component could be used for rating something other than movies. Using the action helper, the consumer can pass down an action with additional arguments (the movie id) and the Stars component can utilize that action and pass along its own arguments. The fn helper does not function in the same way, and the second argument in the handleRatingUpdate action handler results in undefined.
Activity
rwjblue commentedon Apr 23, 2019
Thanks for reporting! Definitely a bug, I'll also PR an update to the RFC prose to clarify the intent as well.
kovalchik commentedon Apr 24, 2019
Thanks for the fix! Works after testing! 🙌