diff --git a/src/components/orchestrator/UseLunatic.tsx b/src/components/orchestrator/UseLunatic.tsx index eeec554a..39ec9119 100644 --- a/src/components/orchestrator/UseLunatic.tsx +++ b/src/components/orchestrator/UseLunatic.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState, PropsWithChildren, useCallback } from 'react'; +import {useEffect, useState, PropsWithChildren, useCallback, useMemo} from 'react'; import { useLunatic } from '@inseefr/lunatic'; import * as custom from '@inseefr/lunatic-dsfr'; import { OrchestratedElement } from '../../typeStromae/type'; @@ -20,7 +20,6 @@ export function UseLunatic(props: PropsWithChildren) { disabled, metadata, } = props; - const [args, setArgs] = useState>({}); const { data, stateData = { currentPage: '1' } } = surveyUnitData ?? {}; const { currentPage } = stateData; const [currentChange, setCurrentChange] = useState<{ name: string }>(); @@ -29,8 +28,7 @@ export function UseLunatic(props: PropsWithChildren) { setCurrentChange({ name }); }, []); - useEffect(() => { - setArgs({ + const args = useMemo(() => ({ getReferentiel, custom, preferences, @@ -38,8 +36,7 @@ export function UseLunatic(props: PropsWithChildren) { savingType, autoSuggesterLoading, onChange, - }); - }, [ + }), [ getReferentiel, preferences, features,