Files
klz-cables.com/.pnpm-store/v10/files/9f/fa5bdbfe2e6e871036b0deb8b19b673d4cc2ec96654b4904ef63599f3fe575a05269e494fb9d46aecf9e7779296ec92822a4eb67be93844d9b0fba613ef234
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

111 lines
2.6 KiB
Plaintext

'use client';
import { c as _c } from "react/compiler-runtime";
import { jsx as _jsx } from "react/jsx-runtime";
import { usePathname, useRouter } from 'next/navigation.js';
import React, { createContext, use, useCallback, useEffect, useRef } from 'react';
import { useEffectEvent } from '../../hooks/useEffectEvent.js';
const Context = /*#__PURE__*/createContext({
cachingEnabled: true,
clearRouteCache: () => {}
});
export const RouteCache = t0 => {
const $ = _c(17);
const {
cachingEnabled: t1,
children
} = t0;
const cachingEnabled = t1 === undefined ? true : t1;
const pathname = usePathname();
const router = useRouter();
const clearAfterPathnameChange = useRef(false);
let t2;
if ($[0] !== router) {
t2 = () => {
router.refresh();
};
$[0] = router;
$[1] = t2;
} else {
t2 = $[1];
}
const clearRouteCache = t2;
let t3;
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
t3 = () => {
const handlePopState = () => {
clearAfterPathnameChange.current = true;
};
window.addEventListener("popstate", handlePopState);
return () => {
window.removeEventListener("popstate", handlePopState);
};
};
$[2] = t3;
} else {
t3 = $[2];
}
let t4;
if ($[3] !== router) {
t4 = [router];
$[3] = router;
$[4] = t4;
} else {
t4 = $[4];
}
useEffect(t3, t4);
let t5;
if ($[5] !== cachingEnabled || $[6] !== clearRouteCache) {
t5 = pathname_0 => {
if (cachingEnabled || clearAfterPathnameChange.current) {
clearAfterPathnameChange.current = false;
clearRouteCache();
}
};
$[5] = cachingEnabled;
$[6] = clearRouteCache;
$[7] = t5;
} else {
t5 = $[7];
}
const handlePathnameChange = useEffectEvent(t5);
let t6;
if ($[8] !== handlePathnameChange || $[9] !== pathname) {
t6 = () => {
handlePathnameChange(pathname);
};
$[8] = handlePathnameChange;
$[9] = pathname;
$[10] = t6;
} else {
t6 = $[10];
}
let t7;
if ($[11] !== pathname) {
t7 = [pathname];
$[11] = pathname;
$[12] = t7;
} else {
t7 = $[12];
}
useEffect(t6, t7);
let t8;
if ($[13] !== cachingEnabled || $[14] !== children || $[15] !== clearRouteCache) {
t8 = _jsx(Context, {
value: {
cachingEnabled,
clearRouteCache
},
children
});
$[13] = cachingEnabled;
$[14] = children;
$[15] = clearRouteCache;
$[16] = t8;
} else {
t8 = $[16];
}
return t8;
};
export const useRouteCache = () => use(Context);
//# sourceMappingURL=index.js.map