Files
klz-cables.com/.pnpm-store/v10/files/57/9d2542ff4677629b5eadb6c442d6ae51ebf8e5e0f2ca28ec8dd193ca2222927a795320c355ca87ab5e2fd87e6592eea22f26cbe43c55013c1641d0bc9b534f
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

52 lines
1.6 KiB
Plaintext

"use client";
import NextLink from 'next/link';
import { usePathname } from 'next/navigation';
import { forwardRef } from 'react';
import { useLocale } from 'use-intl';
import syncLocaleCookie from './syncLocaleCookie.js';
import { jsx } from 'react/jsx-runtime';
function BaseLink({
href,
locale,
localeCookie,
onClick,
prefetch,
...rest
}, ref) {
const curLocale = useLocale();
const isChangingLocale = locale != null && locale !== curLocale;
// The types aren't entirely correct here. Outside of Next.js
// `useParams` can be called, but the return type is `null`.
const pathname = usePathname();
function onLinkClick(event) {
// Even though we force a prefix when changing locales,
// this could be a cache hit of the client-side router,
// therefore we sync the cookie to ensure it's up to date.
syncLocaleCookie(localeCookie, pathname, curLocale, locale);
if (onClick) onClick(event);
}
if (isChangingLocale) {
if (prefetch && "development" !== 'production') {
console.error('The `prefetch` prop is currently not supported when using the `locale` prop on `Link` to switch the locale.`');
}
prefetch = false;
}
// Somehow the types for `next/link` don't work as expected
// when `moduleResolution: "nodenext"` is used.
const Link = NextLink;
return /*#__PURE__*/jsx(Link, {
ref: ref,
href: href,
hrefLang: isChangingLocale ? locale : undefined,
onClick: onLinkClick,
prefetch: prefetch,
...rest
});
}
var BaseLink$1 = /*#__PURE__*/forwardRef(BaseLink);
export { BaseLink$1 as default };