Skip to content

Commit

Permalink
Revert "Merge pull request steemit#2347 from steemit/2282-wait-for-us…
Browse files Browse the repository at this point in the history
…er-input-to-stop-before-validating"

This reverts commit 1930568, reversing
changes made to f85e960.

caused issue steemit#2387
  • Loading branch information
bnchdrff committed Feb 12, 2018
1 parent 85b91d9 commit 326bebc
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions src/app/utils/ReactForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@
@arg {object} initialValues required for checkboxes {save: false, ...}
@arg {function} validation - values => ({ username: ! values.username ? 'Required' : null, ... })
*/
const USER_INPUT_DEBOUNCE_MS = 400;

export default function reactForm({
name,
instance,
fields,
initialValues,
validation = () => {},
}) {
let debounce = { timeout: null };
if (typeof instance !== 'object')
throw new TypeError('instance is a required object');
if (!Array.isArray(fields))
Expand Down Expand Up @@ -124,13 +121,7 @@ export default function reactForm({
}

instance.setState({ [fieldName]: v }, () => {
setFormStateDebounce(
name,
instance,
fields,
validation,
debounce
);
setFormState(name, instance, fields, validation);
});
};

Expand All @@ -143,13 +134,6 @@ export default function reactForm({
}
}

function setFormStateDebounce(name, instance, fields, validation, debounce) {
clearTimeout(debounce.timeout);
debounce.timeout = setTimeout(function() {
setFormState(name, instance, fields, validation);
}, USER_INPUT_DEBOUNCE_MS);
}

function setFormState(name, instance, fields, validation) {
let formValid = true;
let formTouched = false;
Expand Down

0 comments on commit 326bebc

Please sign in to comment.