The required resources field is not always present, leading the logical view to crash when it is not present. (#9959)

Co-authored-by: Max Fitton <max@semprehealth.com>
This commit is contained in:
Max FittonandMax Fitton authored and SangBin Cho committed 2020-08-06 17:07:30 -07:00
1 parent 59a4c86497
commit 735cc40162
2 files changed
+2 -1

No files matched your search

+1 -1
View File
@@ -189,7 +189,7 @@ export type FullActorInfo = {
export type PartialActorInfo = {
actorId: string;
actorTitle: string;
requiredResources: { [key: string]: number };
requiredResources?: { [key: string]: number };
state: ActorState.Invalid;
invalidStateType?: InvalidStateType;
};
@@ -192,6 +192,7 @@ class Actor extends React.Component<Props & WithStyles<typeof styles>, State> {
{
label: "Required resources",
value:
actor.requiredResources &&
Object.entries(actor.requiredResources).length > 0 &&
Object.entries(actor.requiredResources)
.sort((a, b) => a[0].localeCompare(b[0]))