Skip to content

Commit

Permalink
fix: rename
Browse files Browse the repository at this point in the history
  • Loading branch information
ob6160 committed Feb 13, 2022
1 parent 4910dc3 commit cf8c7cf
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/components/LooMap/AccessibilityList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,15 @@ const Content = ({ toilets }) => {
);
};

const AccessibilityList = ({ toilets, ...props }) => {
const AccessibilityList = ({
toilets,
...props
}: {
toilets: CompressedLooObject[];
}) => {
const [showContent, setShowContent] = React.useState(false);

// Fetch proper loo names
// Fetch loo names
const unorderedNames = useLooNamesByIdsQuery({
variables: { idList: toilets.map((t) => t?.id) },
});
Expand All @@ -99,11 +104,11 @@ const AccessibilityList = ({ toilets, ...props }) => {
}, 300);
}, []);

const mapIdToName = Object.fromEntries(
const nameMap = Object.fromEntries(
unorderedNames.data?.looNamesByIds.map((e) => [e.id, e.name]) || []
);

const names = toilets.map((t) => mapIdToName[t?.id] || 'Toilet Loading');
const names = toilets.map((t) => nameMap[t?.id] || 'Name Unknown');

return (
<div
Expand Down

0 comments on commit cf8c7cf

Please sign in to comment.