Skip to content

Commit

Permalink
Wait for schemas and metadata to be saved before displaying imported …
Browse files Browse the repository at this point in the history
…credentials
  • Loading branch information
Hjort committed Aug 22, 2023
1 parent ff5deee commit 573379e
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function updateList<T>(stored: T[], toAdd: T[], isEqual: (a: T, b: T) => boolean
function updateRecord<T>(
stored: Record<string, T>,
toAdd: Record<string, T>,
update: (updated: Record<string, T>) => void
update: (updated: Record<string, T>) => Promise<void>
) {
const updated = { ...stored };
Object.entries(toAdd).forEach(([key, value]) => {
Expand All @@ -70,7 +70,7 @@ function updateRecord<T>(
}
});

update(updated);
return update(updated);
}

export default function VerifiableCredentialImport() {
Expand Down Expand Up @@ -100,8 +100,8 @@ export default function VerifiableCredentialImport() {
(a, b) => a.id === b.id,
setVerifiableCredentials
);
updateRecord(storedSchemas.value, schemas, setSchemas);
updateRecord(storedMetadata.value, metadata, setMetadata);
await updateRecord(storedSchemas.value, schemas, setSchemas);
await updateRecord(storedMetadata.value, metadata, setMetadata);
setImported(filteredCredentials);
}
} catch (e) {
Expand Down

0 comments on commit 573379e

Please sign in to comment.