From 8f2014ea6fc0515905dcfe39f8368cc76f16d601 Mon Sep 17 00:00:00 2001 From: David Walker Date: Mon, 9 Jan 2023 20:02:26 -0800 Subject: [PATCH] BUGFIX: Fix rendering of GenericLocation Fixes #316. Rollback of the change to GenericLocation made in the previous PR, plus adding keys (instead) to address the original problem. --- src/Locations/ui/GenericLocation.tsx | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/Locations/ui/GenericLocation.tsx b/src/Locations/ui/GenericLocation.tsx index 269f734e4..f839f5919 100644 --- a/src/Locations/ui/GenericLocation.tsx +++ b/src/Locations/ui/GenericLocation.tsx @@ -41,47 +41,49 @@ export function GenericLocation({ loc }: IProps): React.ReactElement { * Determine what needs to be rendered for this location based on the locations * type. Returns an array of React components that should be rendered */ - function getLocationSpecificContent(): React.ReactNode { + function getLocationSpecificContent(): React.ReactNode[] { + const content: React.ReactNode[] = []; + if (loc.types.includes(LocationType.Company)) { - return ; + content.push(); } if (loc.types.includes(LocationType.Gym)) { - return ; + content.push(); } if (loc.types.includes(LocationType.Hospital)) { - return ; + content.push(); } if (loc.types.includes(LocationType.Slums)) { - return ; + content.push(); } if (loc.types.includes(LocationType.Special)) { - return ; + content.push(); } if (loc.types.includes(LocationType.TechVendor)) { - return ; + content.push(); } if (loc.types.includes(LocationType.TravelAgency)) { - return ; + content.push(); } if (loc.types.includes(LocationType.University)) { - return ; + content.push(); } if (loc.types.includes(LocationType.Casino)) { - return ; + content.push(); } - return null; + return content; } - const locContent: React.ReactNode = getLocationSpecificContent(); + const locContent: React.ReactNode[] = getLocationSpecificContent(); const serverMeta = serverMetadata.find((s) => s.specialName === loc.name); const server = GetServer(serverMeta ? serverMeta.hostname : "");