Skip to content

Commit

Permalink
Fix failing test (2)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebelga committed Aug 19, 2020
1 parent a95c282 commit d62f9a7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export const FormWizardProvider = WithMultiContent<Props<any>>(function FormWiza
return nextState;
});
},
[getStepIndex, validate, onSave, getData]
[getStepIndex, validate, onSave, getData, lastStep]
);

const value: Context = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@ export const useMappingsStateListener = ({ onChange, value }: Args) => {
const dispatch = useDispatch();

const parsedFieldsDefaultValue = useMemo(() => normalize(value?.fields), [value?.fields]);

useEffect(() => {
// If we are creating a new field, but haven't entered any name
// it is valid and we can byPass its form validation (that requires a "name" to be defined)
const isFieldFormVisible = state.fieldForm !== undefined;
const emptyNameValue =
isFieldFormVisible &&
state.fieldForm!.data.raw.name !== undefined &&
state.fieldForm!.data.raw.name.trim() === '';
(state.fieldForm!.data.raw.name === undefined ||
state.fieldForm!.data.raw.name.trim() === '');

const bypassFieldFormValidation =
state.documentFields.status === 'creatingField' && emptyNameValue;
Expand Down

0 comments on commit d62f9a7

Please sign in to comment.