From e5cb1eaf5ce00bae99223a98484b788766f283a5 Mon Sep 17 00:00:00 2001 From: Sean Fong Date: Mon, 23 Dec 2024 10:12:14 +1030 Subject: [PATCH] Add await to updatedPopulatedProperties call in usePopulate hook --- .../src/features/prepopulate/hooks/usePopulate.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/smart-forms-app/src/features/prepopulate/hooks/usePopulate.tsx b/apps/smart-forms-app/src/features/prepopulate/hooks/usePopulate.tsx index 967584280..60d9265b2 100644 --- a/apps/smart-forms-app/src/features/prepopulate/hooks/usePopulate.tsx +++ b/apps/smart-forms-app/src/features/prepopulate/hooks/usePopulate.tsx @@ -77,7 +77,7 @@ function usePopulate(spinner: RendererSpinner, onStopSpinner: () => void): void setIsPopulated(true); populateQuestionnaire(sourceQuestionnaire, smartClient, patient, user, encounter, fhirPathContext) - .then(({ populateSuccess, populateResult }) => { + .then(async ({ populateSuccess, populateResult }) => { if (!populateSuccess || !populateResult) { onStopSpinner(); enqueueSnackbar('Form not populated', { action: , variant: 'warning' }); @@ -85,7 +85,7 @@ function usePopulate(spinner: RendererSpinner, onStopSpinner: () => void): void } const { populated, hasWarnings, populatedContext } = populateResult; - const updatedResponse = updatePopulatedProperties(populated, populatedContext); + const updatedResponse = await updatePopulatedProperties(populated, populatedContext); setUpdatableResponseAsPopulated(updatedResponse); onStopSpinner(); if (hasWarnings) {