Skip to content

Commit 910920b

Browse files
author
Erik Dakoda
authored
Merge pull request VulcanJS#2687 from ErikDakoda/SmartForm_minor_bug_fixes_Jan_2020
SmartForm minor bug fixes Jan 2020
2 parents 2e6f980 + 74cd4bf commit 910920b

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

packages/vulcan-forms/lib/components/Form.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,6 @@ class SmartForm extends Component {
375375
// intialize properties
376376
let field = {
377377
..._.pick(fieldSchema, formProperties),
378-
document: this.state.initialDocument,
379378
name: fieldName,
380379
datatype: fieldSchema.type,
381380
layout: this.props.layout,
@@ -401,6 +400,7 @@ class SmartForm extends Component {
401400
// }
402401

403402
const document = this.getDocument();
403+
field.document = document;
404404

405405
// internationalize field options labels
406406
if (field.options && Array.isArray(field.options)) {
@@ -1022,7 +1022,7 @@ class SmartForm extends Component {
10221022
const meta = this.props[`create${this.props.typeName}Meta`];
10231023
// in new versions of Apollo Client errors are no longer thrown/caught
10241024
// but can instead be provided as props by the useMutation hook
1025-
if (meta.error) {
1025+
if (meta?.error) {
10261026
this.mutationErrorCallback(document, meta.error);
10271027
} else {
10281028
this.newMutationSuccessCallback(result);

packages/vulcan-forms/lib/components/FormComponent.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class FormComponent extends Component {
3232
}
3333
const path = getPath(props);
3434
const intlOrRegularValue = get(document, path);
35-
const value = typeof intlOrRegularValue === 'object' ? intlOrRegularValue.value : intlOrRegularValue;
35+
const value = (intlOrRegularValue && typeof intlOrRegularValue === 'object') ? intlOrRegularValue.value : intlOrRegularValue;
3636
return getCharacterCounts(value, max);
3737
}
3838

packages/vulcan-lib/lib/modules/intl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const getString = ({ id, values, defaultMessage, messages, locale }) => {
3737
message = defaultMessage;
3838
}
3939

40-
if (values && typeof values === 'object') {
40+
if (values && typeof values === 'object' && typeof message === 'string') {
4141
message = pluralizeString(message, values);
4242
message = substituteStringValues(message, values);
4343
}

packages/vulcan-ui-material/lib/components/forms/base-controls/FormInput.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const FormInput = createReactClass({
8888
if (value !== this.props.value) {
8989
this.props.handleChange(value);
9090
}
91-
}, 500);
91+
}, 500, { leading: true });
9292

9393
if (this.props.refFunction) {
9494
this.props.refFunction(this);

0 commit comments

Comments
 (0)