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

Implement SpinButton onValidValueUpdated callback. #7577

Closed
wants to merge 10 commits into from
Closed

Implement SpinButton onValidValueUpdated callback. #7577

wants to merge 10 commits into from

Conversation

lijunle
Copy link
Member

@lijunle lijunle commented Jan 9, 2019

Pull request checklist

Description of changes

Implement SpinButton's onValidValueUpdated callback to notify the parent to control the component..

Focus areas to test

SpinButton component.

Microsoft Reviewers: Open in CodeFlow

@size-auditor
Copy link

size-auditor bot commented Jan 9, 2019

Component Baseline Size PR Size Size Change Bundle Size Tolerance Level
SpinButton 232905 233033 128 🔺 ✔️

* This callback is triggered after SpinButton normalized and validated the user input value.
* @param value - The normalized and valid value in the input box.
*/
onValidValueUpdated?: (value: string) => void;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onValidValueUpdated?: (value: string) => void; [](start = 2, length = 46)

Should there be some information on how this should be used taking into account the onIncrement, onDecrement, and onValidate props? Also, how do those props and this one work together? If they don't work together in a sensible way there should be a warn mutually exclusive telling creators not to combine them (potentially as well as something in the documentation here)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are not really related. They work together great as the way they work. The onIncrement/onDecrement/onValidate is to inject some customized logic, the onValidValueUpdated is to listen on something happens. I think the doc here is completed, mention something unrelated is not wise.

Copy link
Member

@JasonGore JasonGore Jan 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the callback naming onValidValueUpdated is pretty complex and speaks to a lot of the architectural issues that SpinButton has (as discussed in #5326.) However, we do have an onValidate, as well as callbacks that use past tense naming to imply an action occurred. Could this be more simply named onValidated?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JasonGore I am fine with any naming part. IMO, one difference of onValidValueUpdated and onValidated is do we want to trigger the callback after validated with the same value. Again, I am fine with both.

I totally agree that the name exposes the architectural issue of SpinButton. I could like to help if we have a clear direction on goal. Could you please like to provide your ideas/suggestions to my questions here?

Copy link
Contributor

@jspurlin jspurlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@lijunle
Copy link
Member Author

lijunle commented Jan 14, 2019

@jspurlin Thank you very much for helping reviewing the changes!

@ecraig12345 Could you please help on taking a look?

@dzearing
Copy link
Member

I'm a bit concerned with the naming here. Are we making this component more complicated than it needs to be?

@dzearing
Copy link
Member

What I mean:

I expect to make a controlled version of this component like an input element:

I render using value <SpinButton value={12} ... />

The user clicks up arrow

The onChange event fires

The user gets the new value and rerenders, or, the user ignores the update and nothing changes.

Why do we need any more complexity than this?

Copy link
Member

@dzearing dzearing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's hold and discuss this internally first.

@lijunle
Copy link
Member Author

lijunle commented Jan 16, 2019

@dzearing The behavior of onChange is unclear yet, see the discussion in #5326 (comment)

If we have a clear view about how onChange callback works, I could like to contribute on it.

@dzearing
Copy link
Member

@lijunle when you're back, let's reconvene on this issue. Closing the PR for now.

@dzearing dzearing closed this Feb 12, 2019
@lijunle lijunle deleted the spin-button/on-valid-value-updated branch February 20, 2019 04:52
@microsoft microsoft deleted a comment from msft-github-bot Jun 12, 2019
@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants