Skip to content

useStepsForm does not preserve form field values when returning to Previous step #269

Description

@jayberry14

Hi guys, thanks in advance for the help

I've imported useStepsForm and used it as shown in the example code. Since the very beginning of using this hook I've not been able to preserve the field values when returning to a previous step in my form. The validation does work in this case.

If I then take the form prop returned from the useStepsForm hook and name it something besides 'form', the validation fails but the data from each field is properly preserved on previous steps after progressing further in the form. I suspect the validation fails because in this case the form isn't actually the same one as before, so it doesn't recognize the validation rules.

Any insights on this issue would be greatly appreciated! Let me know if you need any other information

const [rootForm] = Form.useForm();

const { form, current, gotoStep, submit } = useStepsForm({
    submit: async (values) => {
      onFinish(values);
      await new Promise((r) => setTimeout(r, 1000));
      return 'ok';
    },
    form: rootForm,
    total: fieldsKeys.length,
    isBackValidate: false,
  });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions