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

30 lines
1.0 KiB
Plaintext

export function abortAndIgnore(abortController) {
if (abortController) {
try {
abortController.abort();
} catch (_err) {
// swallow error
}
}
}
/**
* Use this function when an effect is triggered multiple times over and you want to cancel the previous effect.
* It will abort the previous effect and create a new AbortController for the next effect.
* Important: You must also _reset_ the `abortControllerRef` after the effect is done, otherwise the next effect will be aborted immediately.
* For example, run `abortControllerRef.current = null` in a `finally` block or after an awaited promise.
* @param abortControllerRef
* @returns {AbortController}
*/
export function handleAbortRef(abortControllerRef) {
const newController = new AbortController();
if (abortControllerRef.current) {
try {
abortControllerRef.current.abort();
} catch (_err) {
// swallow error
}
}
abortControllerRef.current = newController;
return newController;
}
//# sourceMappingURL=abortAndIgnore.js.map