From b3497980176ac4b88e43f4004364bc749f549fb5 Mon Sep 17 00:00:00 2001 From: Samantha Kellow Date: Fri, 24 Nov 2023 09:11:29 +0000 Subject: [PATCH] linting and error amends --- components/product/sustainability-info.tsx | 2 +- components/product/variant-selector.tsx | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/components/product/sustainability-info.tsx b/components/product/sustainability-info.tsx index 0932542bf..727ebcc00 100644 --- a/components/product/sustainability-info.tsx +++ b/components/product/sustainability-info.tsx @@ -18,7 +18,7 @@ export function SustainabilityInfo() { {credentials[credential as keyof typeof credentials].title} - "{credentials[credential as keyof typeof credentials].excerpt}"

+ `{credentials[credential as keyof typeof credentials].excerpt}`

void, + setSelectedVariant: (newVariant: OptimizedVariant | undefined) => void, }) { const pathname = usePathname(); const currentParams = useSearchParams(); const router = useRouter(); const hasNoOptionsOrJustOneOption = !options.length || (options.length === 1 && options[0]?.values.length === 1); - - if (hasNoOptionsOrJustOneOption) { - return null; - } - // Discard any unexpected options or values from url and create params map. const paramsMap: ParamsMap = Object.fromEntries( Array.from(currentParams.entries()).filter(([key, value]) => @@ -87,6 +82,10 @@ export function VariantSelector({ useEffect(() => { setSelectedVariant(selectedVariant); }, [selectedVariantUrl]); + + if (hasNoOptionsOrJustOneOption) { + return null; + } if (currentUrl !== selectedVariantUrl) { router.replace(selectedVariantUrl);