diff --git a/apps/web/process/load-kp/reactions.ts b/apps/web/process/load-kp/reactions.ts index d31370a..489442c 100644 --- a/apps/web/process/load-kp/reactions.ts +++ b/apps/web/process/load-kp/reactions.ts @@ -15,7 +15,7 @@ export function common({ store, trpcClient, apolloClient }: ProcessContext) { reaction( () => $calculation.$values.getValue('quote'), - async () => { + () => { const quote = $calculation.element('selectQuote').getOption(); if (!quote || $process.has('LoadKP') || $process.has('Calculate') || $process.has('CreateKP')) @@ -29,8 +29,6 @@ export function common({ store, trpcClient, apolloClient }: ProcessContext) { onClick: () => message.destroy(key), }); - const eltInitialValues = await initElt(); - trpcClient.getQuote .query({ values: { @@ -38,7 +36,7 @@ export function common({ store, trpcClient, apolloClient }: ProcessContext) { ...$calculation.$values.getValues(['lead', 'opportunity', 'recalcWithRevision']), }, }) - .then(({ values, payments, insurance, fingap, elt, options }) => { + .then(async ({ values, payments, insurance, fingap, elt, options }) => { if (options?.selectTarif) { $calculation.element('selectTarif').setOptions(normalizeOptions(options.selectTarif)); } else { @@ -76,6 +74,7 @@ export function common({ store, trpcClient, apolloClient }: ProcessContext) { $tables.fingap.setRisks(fingap.risks); $tables.fingap.setSelectedKeys(fingap.keys); } + const eltInitialValues = await initElt(); if (eltInitialValues) { $tables.elt.kasko.setRows(eltInitialValues.kasko);