Files
klz-cables.com/.pnpm-store/v10/files/94/e44748fc26d396898bc18bda2f9d2ab2c820fe6300574403c85b84da52371c8d2e21d3f9172ff45f9efb5b4f9bd4d0093f07cb0697dbb71336baa80f558dad
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

61 lines
1.5 KiB
Plaintext

'use client';
import { c as _c } from "react/compiler-runtime";
import { useEffect, useRef } from 'react';
/**
* A hook that will throttle the execution of a callback function inside a useEffect.
* This is useful for things like throttling loading states or other UI updates.
* @param callback The callback function to be executed.
* @param delay The delay in milliseconds to throttle the callback.
* @param deps The dependencies to watch for changes.
*/
export const useThrottledEffect = (callback, delay, t0) => {
const $ = _c(9);
let t1;
if ($[0] !== t0) {
t1 = t0 === undefined ? [] : t0;
$[0] = t0;
$[1] = t1;
} else {
t1 = $[1];
}
const deps = t1;
let t2;
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
t2 = Date.now();
$[2] = t2;
} else {
t2 = $[2];
}
const lastRan = useRef(t2);
let t3;
if ($[3] !== callback || $[4] !== delay) {
t3 = () => {
const handler = setTimeout(() => {
if (Date.now() - lastRan.current >= delay) {
callback();
lastRan.current = Date.now();
}
}, delay - (Date.now() - lastRan.current));
return () => {
clearTimeout(handler);
};
};
$[3] = callback;
$[4] = delay;
$[5] = t3;
} else {
t3 = $[5];
}
let t4;
if ($[6] !== delay || $[7] !== deps) {
t4 = [delay, ...deps];
$[6] = delay;
$[7] = deps;
$[8] = t4;
} else {
t4 = $[8];
}
useEffect(t3, t4);
};
//# sourceMappingURL=useThrottledEffect.js.map