Skip to content

Commit

Permalink
fix(Form): Inhibit value prop for input
Browse files Browse the repository at this point in the history
BREAKING CHANGE: No longer be able to provide value prop for input
  • Loading branch information
osaario committed Nov 20, 2018
1 parent 010a54f commit bfb8a3a
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,9 @@ const omitFromInputs = ['ref', 'for', 'leftAddon', 'rightAddon']
.concat(Object.keys(numberRules))
export class Form<T> extends React.Component<FormProps<T>, FormState> {
state: FormState = {
// no #s yet registered so lets just cast this
fields: {}
}
getValidationForField(lens: any) {
// field not touched
const rules = L.get([lens, 'rules'], this.state.fields)
if (rules) {
const value = L.get([lens], this.props.value)
Expand Down Expand Up @@ -485,11 +483,9 @@ export class Form<T> extends React.Component<FormProps<T>, FormState> {
emitChange = <A extends keyof T, U extends keyof T[A], S extends keyof T[A][U], K extends keyof T[A][U][S]>(
event: FormEventType<T, A, U, S, K>
) => {
// a hack to know if these are fed
if (typeof event.value === 'object') {
const newIndexes = getIndexesFor(event.value)
const value = newIndexes.reduce((acc: any, val: any) => {
// remove undefined indices
if (val[1] === undefined) {
return L.remove([event.for, val[0]], acc)
} else {
Expand Down

0 comments on commit bfb8a3a

Please # to comment.