mirror of
https://github.com/vercel/commerce.git
synced 2025-05-12 20:57:51 +00:00
linting and error amends
This commit is contained in:
parent
4e33afc9dc
commit
b349798017
@ -18,7 +18,7 @@ export function SustainabilityInfo() {
|
||||
<AccordionItem id={credential} key={credential} value={credential}>
|
||||
<AccordionTrigger className="text-xs py-3">{credentials[credential as keyof typeof credentials].title}</AccordionTrigger>
|
||||
<AccordionContent>
|
||||
"{credentials[credential as keyof typeof credentials].excerpt}" <br /><br/>
|
||||
`{credentials[credential as keyof typeof credentials].excerpt}` <br /><br/>
|
||||
<Link
|
||||
className="text-bold pt-6"
|
||||
href={credentials[credential as keyof typeof credentials].link}
|
||||
|
@ -26,18 +26,13 @@ export function VariantSelector({
|
||||
}: {
|
||||
options: ProductOption[];
|
||||
variants: ProductVariant[];
|
||||
setSelectedVariant: (newVariant: ProductVariant) => 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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user