Files
klz-cables.com/.pnpm-store/v10/files/4e/c59a241297f5f15c515443c17180d501157c0fba968f192542310488a5c84a580944c1d43f7e5e5f8dc37eea0b0ce0c7b0df681dbfac88a565560243d09e46
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

33 lines
932 B
Plaintext

'use client';
import { c as _c } from "react/compiler-runtime";
import { useCallback, useRef } from 'react';
/**
* Returns a memoized function that will only call the passed function when it hasn't been called for the wait period
* @param func The function to be called
* @param wait Wait period after function hasn't been called for
* @returns A memoized function that is debounced
*/
export const useDebouncedCallback = (func, wait) => {
const $ = _c(3);
const timeout = useRef(undefined);
let t0;
if ($[0] !== func || $[1] !== wait) {
t0 = (...t1) => {
const args = t1;
const later = () => {
clearTimeout(timeout.current);
func(...args);
};
clearTimeout(timeout.current);
timeout.current = setTimeout(later, wait);
};
$[0] = func;
$[1] = wait;
$[2] = t0;
} else {
t0 = $[2];
}
return t0;
};
//# sourceMappingURL=useDebouncedCallback.js.map