mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-10 21:39:02 +08:00
Feat: Upgrade react-hook-form to the latest version to solve the problem that appending a useFieldArray entry cannot trigger the watch callback function #3221 (#7849)
### What problem does this PR solve? Feat: Upgrade react-hook-form to the latest version to solve the problem that appending a useFieldArray entry cannot trigger the watch callback function #3221 [issue: watch is not called when appending first item to Field Array #12370](https://github.com/react-hook-form/react-hook-form/issues/12370) ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
parent
be83074131
commit
78fa37f8ae
9
web/package-lock.json
generated
9
web/package-lock.json
generated
@ -72,7 +72,7 @@
|
|||||||
"react-copy-to-clipboard": "^5.1.0",
|
"react-copy-to-clipboard": "^5.1.0",
|
||||||
"react-dropzone": "^14.3.5",
|
"react-dropzone": "^14.3.5",
|
||||||
"react-error-boundary": "^4.0.13",
|
"react-error-boundary": "^4.0.13",
|
||||||
"react-hook-form": "^7.53.1",
|
"react-hook-form": "^7.56.4",
|
||||||
"react-i18next": "^14.0.0",
|
"react-i18next": "^14.0.0",
|
||||||
"react-infinite-scroll-component": "^6.1.0",
|
"react-infinite-scroll-component": "^6.1.0",
|
||||||
"react-markdown": "^9.0.1",
|
"react-markdown": "^9.0.1",
|
||||||
@ -27245,9 +27245,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-hook-form": {
|
"node_modules/react-hook-form": {
|
||||||
"version": "7.53.1",
|
"version": "7.56.4",
|
||||||
"resolved": "https://registry.npmmirror.com/react-hook-form/-/react-hook-form-7.53.1.tgz",
|
"resolved": "https://registry.npmmirror.com/react-hook-form/-/react-hook-form-7.56.4.tgz",
|
||||||
"integrity": "sha512-6aiQeBda4zjcuaugWvim9WsGqisoUk+etmFEsSUMm451/Ic8L/UAb7sRtMj3V+Hdzm6mMjU1VhiSzYUZeBm0Vg==",
|
"integrity": "sha512-Rob7Ftz2vyZ/ZGsQZPaRdIefkgOSrQSPXfqBdvOPwJfoGnjwRJUs7EM7Kc1mcoDv3NOtqBzPGbcMB8CGn9CKgw==",
|
||||||
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0"
|
"node": ">=18.0.0"
|
||||||
},
|
},
|
||||||
|
@ -83,7 +83,7 @@
|
|||||||
"react-copy-to-clipboard": "^5.1.0",
|
"react-copy-to-clipboard": "^5.1.0",
|
||||||
"react-dropzone": "^14.3.5",
|
"react-dropzone": "^14.3.5",
|
||||||
"react-error-boundary": "^4.0.13",
|
"react-error-boundary": "^4.0.13",
|
||||||
"react-hook-form": "^7.53.1",
|
"react-hook-form": "^7.56.4",
|
||||||
"react-i18next": "^14.0.0",
|
"react-i18next": "^14.0.0",
|
||||||
"react-infinite-scroll-component": "^6.1.0",
|
"react-infinite-scroll-component": "^6.1.0",
|
||||||
"react-markdown": "^9.0.1",
|
"react-markdown": "^9.0.1",
|
||||||
|
@ -126,9 +126,17 @@ export function useFormConfigMap() {
|
|||||||
},
|
},
|
||||||
[Operator.Message]: {
|
[Operator.Message]: {
|
||||||
component: MessageForm,
|
component: MessageForm,
|
||||||
defaultValues: {},
|
defaultValues: {
|
||||||
|
content: [],
|
||||||
|
},
|
||||||
schema: z.object({
|
schema: z.object({
|
||||||
content: z.array(z.string()).optional(),
|
content: z
|
||||||
|
.array(
|
||||||
|
z.object({
|
||||||
|
value: z.string(),
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.optional(),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
[Operator.Relevant]: {
|
[Operator.Relevant]: {
|
||||||
|
@ -43,6 +43,7 @@ const MessageForm = ({ form }: INextOperatorForm) => {
|
|||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="flex-1">
|
<FormItem className="flex-1">
|
||||||
<FormControl>
|
<FormControl>
|
||||||
|
{/* <Input {...field}></Input> */}
|
||||||
<PromptEditor
|
<PromptEditor
|
||||||
{...field}
|
{...field}
|
||||||
placeholder={t('flow.messagePlaceholder')}
|
placeholder={t('flow.messagePlaceholder')}
|
||||||
|
@ -40,6 +40,7 @@ export const useHandleFormValuesChange = (
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const subscription = form?.watch((value, { name, type, values }) => {
|
const subscription = form?.watch((value, { name, type, values }) => {
|
||||||
console.log('🚀 ~ subscription ~ value:', value);
|
console.log('🚀 ~ subscription ~ value:', value);
|
||||||
|
|
||||||
if (id && name) {
|
if (id && name) {
|
||||||
console.log(
|
console.log(
|
||||||
'🚀 ~ useEffect ~ value:',
|
'🚀 ~ useEffect ~ value:',
|
||||||
@ -84,8 +85,12 @@ export const useHandleFormValuesChange = (
|
|||||||
script: CodeTemplateStrMap[value.lang as ProgrammingLanguage],
|
script: CodeTemplateStrMap[value.lang as ProgrammingLanguage],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (operatorName === Operator.Message) {
|
||||||
|
}
|
||||||
|
|
||||||
// Manually triggered form updates are synchronized to the canvas
|
// Manually triggered form updates are synchronized to the canvas
|
||||||
if (type) {
|
if (form.formState.isDirty) {
|
||||||
// run(id, nextValues);
|
// run(id, nextValues);
|
||||||
updateNodeForm(id, nextValues);
|
updateNodeForm(id, nextValues);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user