-
Notifications
You must be signed in to change notification settings - Fork 92
Step value not passed into ComposedSubmit #2389
Copy link
Copy link
Open
Description
Describe the Bug
Files:
- Problem:
node_modules/@graphcommerce/react-hook-form/src/ComposedForm/useFormCompose.ts - Apparent:
node_modules/@graphcommerce/react-hook-form/src/ComposedForm/ComposedSubmit.tsx
Description
The step key is not passed in during the ASSIGN dispatch() on Line 21 of: node_modules/@graphcommerce/react-hook-form/src/ComposedForm/useFormCompose.ts. As a result, the forms ignore the expected step ordering.
Solution:
-dispatch({ type: 'ASSIGN', key, form: form as UseFormReturn<FieldValues>, submit })
+dispatch({ type: 'ASSIGN', key, form: form as UseFormReturn<FieldValues>, submit, step })
A TypeScript modification would be necessary as well.
Here's the full.patch file that works:
diff --git a/node_modules/@graphcommerce/react-hook-form/src/ComposedForm/useFormCompose.ts b/node_modules/@graphcommerce/react-hook-form/src/ComposedForm/useFormCompose.ts
index 58aa7a1..627deae 100644
--- a/node_modules/@graphcommerce/react-hook-form/src/ComposedForm/useFormCompose.ts
+++ b/node_modules/@graphcommerce/react-hook-form/src/ComposedForm/useFormCompose.ts
@@ -18,7 +18,7 @@ export function useFormCompose<V extends Record<string, unknown>>(
}, [dispatch, key, step])
useEffect(() => {
- dispatch({ type: 'ASSIGN', key, form: form as UseFormReturn<FieldValues>, submit })
+ dispatch({ type: 'ASSIGN', key, form: form as UseFormReturn<FieldValues>, submit, step })
}, [dispatch, fields, form, key, submit])
const error = isFormGqlOperation(form) ? form.error : undefined
Expected Behavior
The step values are used to build the array. The code is already there to handle this, it's just not receiving the info it needs.
To Reproduce
- Adjust the
steporder. - Place Order with a multi-step, composed form.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels