move loading state for add user back to the submit button

This change is necessary, because the old loading behaviour forces the form to rerender, which in turn causes a lost of the input. Now the loading state is back to the submit button.
This commit is contained in:
Sebastian Sdorra
2018-07-27 10:54:49 +02:00
parent c7171dd540
commit e34904afce
2 changed files with 7 additions and 3 deletions

View File

@@ -9,6 +9,7 @@ import * as validator from "./userValidation";
type Props = {
submitForm: User => void,
user?: User,
loading?: boolean,
t: string => string
};
@@ -80,7 +81,7 @@ class UserForm extends React.Component<Props, State> {
};
render() {
const { t } = this.props;
const { loading, t } = this.props;
const user = this.state.user;
let nameField = null;
@@ -140,6 +141,7 @@ class UserForm extends React.Component<Props, State> {
/>
<SubmitButton
disabled={!this.isValid()}
loading={loading}
label={t("user-form.submit")}
/>
</form>