fix: call twice in run

pull/21369/head
Joel 11 months ago
parent be76483642
commit fd040bc1ac

@ -1,6 +1,6 @@
'use client'
import type { FC } from 'react'
import React, { useEffect } from 'react'
import React, { useEffect, useRef } from 'react'
import { useTranslation } from 'react-i18next'
import type { Props as FormProps } from './form'
import Form from './form'
@ -133,8 +133,12 @@ const BeforeRunForm: FC<BeforeRunFormProps> = ({
onRun(submitData)
}
const hasRun = useRef(false)
useEffect(() => {
// React 18 run twice in dev mode
if(hasRun.current)
return
hasRun.current = true
if(filteredExistVarForms.length === 0)
onRun({})
}, [filteredExistVarForms, onRun])

Loading…
Cancel
Save