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

[BUGFIX LTS] invoke methods correctly in TextSupport sendAction #19001

Merged
merged 1 commit into from
Jun 2, 2020
Merged

[BUGFIX LTS] invoke methods correctly in TextSupport sendAction #19001

merged 1 commit into from
Jun 2, 2020

Conversation

chriskrycho
Copy link
Contributor

The introduction of the attrs API in Ember 3.13 included wrapping items passed to components with MutableCell, to support two-way binding. Although two-way binding is gone from much of Ember, the text input components (Input and Textarea) continue to support it, via the TextSupport mixins. The sendAction function used by the mixin previously assumed that the only options were for an action to be a string or a function -- not a function wrapped in a MutableCell.

The result was that this code, which would be expected to work, did not: it would simply never be invoked.

<Textarea @focus-in={{this.didFocusIn}} />

Accordingly, add logic to sendAction in text_support.js to unwrap a mutable cell if it is set, and otherwise to carry on with the logic as it was previously.

Backports the fix for #18994 (f16d174) to 3.16 LTS.

The introduction of the `attrs` API in Ember 3.13 included wrapping
items passed to components with `MutableCell`, to support two-way
binding. Although two-way binding is gone from much of Ember, the text
input components (`Input` and `Textarea`) continue to support it, via
the `TextSupport` mixins. The `sendAction` function used by the mixin
previously assumed that the only options were for an action to be a
string or a function -- not a function wrapped in a `MutableCell`.

The result was that this code, which would be expected to work, did not:
it would simply never be invoked.

    <Textarea @Focus-In={{this.didFocusIn}} />

Accordingly, add logic to `sendAction` in `text_support.js` to unwrap a
mutable cell if it is set, and otherwise to carry on with the logic as
it was previously.

Backports the fix for #18994 (f16d174) to 3.16 LTS.
@chriskrycho
Copy link
Contributor Author

@rwjblue as promised!

@rwjblue rwjblue merged commit f10f7b4 into emberjs:lts-3-16 Jun 2, 2020
@rwjblue
Copy link
Member

rwjblue commented Jun 2, 2020

Thank you @chriskrycho!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants