Skip to content

Commit

Permalink
Add await to updatedPopulatedProperties call in usePopulate hook
Browse files Browse the repository at this point in the history
  • Loading branch information
fongsean committed Dec 22, 2024
1 parent c529b72 commit e5cb1ea
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ 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: <CloseSnackbar />, variant: 'warning' });
return;
}

const { populated, hasWarnings, populatedContext } = populateResult;
const updatedResponse = updatePopulatedProperties(populated, populatedContext);
const updatedResponse = await updatePopulatedProperties(populated, populatedContext);
setUpdatableResponseAsPopulated(updatedResponse);
onStopSpinner();
if (hasWarnings) {
Expand Down

0 comments on commit e5cb1ea

Please sign in to comment.