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 #18997

Merged
merged 1 commit into from
May 29, 2020
Merged

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

merged 1 commit into from
May 29, 2020

Conversation

chriskrycho
Copy link
Contributor

@chriskrycho chriskrycho commented May 29, 2020

The introduction of the attrs API in Ember 1.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.

Resolves #18994

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.

Resolves #18994
@rwjblue rwjblue merged commit 0348011 into emberjs:master May 29, 2020
@rwjblue
Copy link
Member

rwjblue commented May 29, 2020

Thank you!

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.

Components using text-support mixin do not work native class actions correctly
2 participants