From 9afc2246db00730a7f029c452f7ed4c5051d3818 Mon Sep 17 00:00:00 2001 From: lublagg Date: Wed, 20 Sep 2023 19:05:20 -0400 Subject: [PATCH] Implementing review fixes. --- src/components/dropdown.tsx | 4 ++-- src/components/summary.tsx | 2 +- src/scripts/api.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/dropdown.tsx b/src/components/dropdown.tsx index 974314e..6eea11a 100644 --- a/src/components/dropdown.tsx +++ b/src/components/dropdown.tsx @@ -3,11 +3,11 @@ import classnames from "classnames"; import { PlaceOptions } from "./place-options"; import { defaultSelectedOptions } from "../constants/constants"; import { AttributeOptions } from "./attribute-options"; - -import css from "./dropdown.scss"; import { YearsOptions } from "./years-options"; import { Summary } from "./summary"; +import css from "./dropdown.scss"; + interface IProps { category: string sectionAltText: string diff --git a/src/components/summary.tsx b/src/components/summary.tsx index 71d60ea..e362f28 100644 --- a/src/components/summary.tsx +++ b/src/components/summary.tsx @@ -29,7 +29,7 @@ export const Summary: React.FC = ({category, selectedOptions}) => { const valueIsDefined = typeof value === "string" && value; const label = attr.label && (valueIsArrayWithLength || valueIsDefined) ? `${attr.label}: ` : ""; - if (Array.isArray(value) && value.length > 0) { + if (valueIsArrayWithLength) { return `${label}${value.join(", ")}`; } else if (value) { return `${attr.label}: ${value}`; diff --git a/src/scripts/api.ts b/src/scripts/api.ts index 9989cd9..27a23ec 100644 --- a/src/scripts/api.ts +++ b/src/scripts/api.ts @@ -35,6 +35,7 @@ export const fetchDataWithRetry = async (req: string, maxRetries = 3) => { const json = await response.json(); return json; } catch (error) { + // eslint-disable-next-line console.log(`Request attempt ${retries + 1} failed:`, error); retries++; } @@ -108,7 +109,6 @@ export const createTableFromSelections = async (selectedOptions: IStateOptions) const {short_desc} = queryParams; if (Array.isArray(short_desc)) { for (const desc of short_desc) { - console.log({desc}); const codapColumnName = attrToCODAPColumnName[desc].attributeNameInCodapTable; allAttrs.push(codapColumnName); } @@ -229,7 +229,7 @@ const getAttrData = async (params: IGetAttrDataParams) => { return values[codapColumnName] = dataItem.Value; }); } else { - console.log("error"); + console.log(`Error: did not receive response for item with these params: ${params}`); } return values; };