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

Enable Mapping Save button when Valid #2859

Merged
merged 20 commits into from
Mar 13, 2018
Merged

Enable Mapping Save button when Valid #2859

merged 20 commits into from
Mar 13, 2018

Conversation

ischolten
Copy link
Contributor

@ischolten ischolten commented Feb 27, 2018

  • CHANGELOG.md updated with a link to the PR (not the Issue)
  • Rebased/mergable
  • Tests pass

Resolves #2808

The problem

InputClickToEdit was only calling the update function during onBlur.

The Solution

Create another update prop function for onKeyUpdate.

@ebb-tide ebb-tide self-requested a review March 5, 2018 21:06
Copy link
Contributor

@ebb-tide ebb-tide left a comment

Choose a reason for hiding this comment

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

a few comments were made.

@@ -7,13 +7,14 @@ class InputClickToEdit extends Component {
this.state = {
isEditing: null,
value: this.props.value,
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe value could be called currentValue instead? currentValue vs. initial value makes this super understandable

@@ -7,13 +7,14 @@ class InputClickToEdit extends Component {
this.state = {
isEditing: null,
Copy link
Contributor

Choose a reason for hiding this comment

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

my instinct would be to initialize isEditing as false- couldn't find a reason for it to be null ?

@@ -88,7 +96,8 @@ const {func, bool, number, string} = PropTypes
InputClickToEdit.propTypes = {
wrapperClass: string.isRequired,
Copy link
Contributor

Choose a reason for hiding this comment

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

You could pull <div className={wrapperClass}> outside the if statement in the render function to stay DRY. :)

@@ -63,7 +71,7 @@ class InputClickToEdit extends Component {
className="form-control input-sm provider--input"
defaultValue={value}
onBlur={this.handleInputBlur}
onKeyDown={this.handleKeyDown}
onKeyUp={this.handleKeyUp}
autoFocus={true}
onFocus={this.handleFocus}
ref={r => (this.inputRef = r)}
Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't look like you're using inputRef anymore?

Copy link
Contributor

@ebb-tide ebb-tide Mar 6, 2018

Choose a reason for hiding this comment

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

if tabIndex is not specified in props, then does the tabIndex of the input become undefined? could it default to 0? I'm afraid undefined would break things. https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex

Copy link
Contributor

@121watts 121watts left a comment

Choose a reason for hiding this comment

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

Solid stuff! Some minor changes requested and then good to go!

this.setState({
isEditing: false,
initialValue: e.target.value,
})
}

handleKeyDown = e => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets define these event types also

wrapperClass: string
value?: string
onChange?: (value: string) => void
onBlur: (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.

This onChange and onBlur probably take Event types.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They do take strings types. I can change the name of those props if they are too similar to the props on the HTML input

})
})

describe('instance methods', () => {})
Copy link
Contributor

Choose a reason for hiding this comment

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

You can cut this out. 😄

}

describe('Components.Shared.ProvidersTableRowNew', () => {
describe('rendering', () => {})
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's cut anything that isn't used.

})
})

describe('instance methods', () => {})
Copy link
Contributor

Choose a reason for hiding this comment

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

same here :)

@ischolten ischolten merged commit 49b9d44 into master Mar 13, 2018
@ischolten ischolten deleted the fix/enable-save branch March 13, 2018 17:07
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.

3 participants