Howto set saveButtonProps.onClick correctly?
I am trying to overwrite the
Inside another Component:
The first console.log gets fired
However the second one is not reached
Can someone help thank you
saveButtonProps.onClicksaveButtonProps.onClick function. However i cant quite get it: const reactHookFormMethods = useStepsForm<BaseRecord, HttpError, ExpenseStartupAPI>({
refineCoreProps: {
action: "edit",
metaData: {
populate: ["administration", "businessplan", "vermittlung","geschaeftsausstattung","weitereKosten"],
},
},
})
...
const {handleSubmit, refineCore:{onFinish}} = reactHookFormMethods
reactHookFormMethods.saveButtonProps.onClick = (e) => {
console.log("saveButtonProps onclick is executed",e)
handleSubmit((values) => {
console.log("iam in hanldesubmit")
const convertedDate = new Date(values.start).toJSON()
values.start = convertedDate
// @ts-ignore
values.financialplan = 14
console.log("🚀 ThIS DATA IS SENT TO BACKEND::::::::::::::::::: ~ file: edit.tsx:64 ~ handleSubmit ~ values", values)
onFinish(values)
})
} const reactHookFormMethods = useStepsForm<BaseRecord, HttpError, ExpenseStartupAPI>({
refineCoreProps: {
action: "edit",
metaData: {
populate: ["administration", "businessplan", "vermittlung","geschaeftsausstattung","weitereKosten"],
},
},
})
...
const {handleSubmit, refineCore:{onFinish}} = reactHookFormMethods
reactHookFormMethods.saveButtonProps.onClick = (e) => {
console.log("saveButtonProps onclick is executed",e)
handleSubmit((values) => {
console.log("iam in hanldesubmit")
const convertedDate = new Date(values.start).toJSON()
values.start = convertedDate
// @ts-ignore
values.financialplan = 14
console.log("🚀 ThIS DATA IS SENT TO BACKEND::::::::::::::::::: ~ file: edit.tsx:64 ~ handleSubmit ~ values", values)
onFinish(values)
})
}Inside another Component:
...
<Edit
isLoading={formLoading}
saveButtonProps={saveButtonProps}
...
/>...
<Edit
isLoading={formLoading}
saveButtonProps={saveButtonProps}
...
/>The first console.log gets fired
console.log("saveButtonProps onclick is executed",e)console.log("saveButtonProps onclick is executed",e)However the second one is not reached
Can someone help thank you
