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

21 lines
779 B
Plaintext

import { useEffect, useState } from 'react';
/**
* A custom React hook to throttle a value so that it updates no more than once every `delay` milliseconds.
* @param {any} value - The value to be throttled.
* @param {number} delay - The minimum delay (in milliseconds) between updates.
* @returns {any} - The throttled value.
*/
export function useThrottledValue(value, delay) {
const [throttledValue, setThrottledValue] = useState(value);
useEffect(() => {
const handler = setTimeout(() => {
setThrottledValue(value);
}, delay);
// Cleanup the timeout if the value changes before the delay is completed
return () => {
clearTimeout(handler);
};
}, [value, delay]);
return throttledValue;
}
//# sourceMappingURL=useThrottledValue.js.map