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
1 line
1.7 KiB
Plaintext
1 line
1.7 KiB
Plaintext
{"version":3,"file":"abortAndIgnore.js","names":["abortAndIgnore","abortController","abort","_err","handleAbortRef","abortControllerRef","newController","AbortController","current"],"sources":["../../src/utilities/abortAndIgnore.ts"],"sourcesContent":["export function abortAndIgnore(abortController: AbortController) {\n if (abortController) {\n try {\n abortController.abort()\n } catch (_err) {\n // swallow error\n }\n }\n}\n\n/**\n * Use this function when an effect is triggered multiple times over and you want to cancel the previous effect.\n * It will abort the previous effect and create a new AbortController for the next effect.\n * Important: You must also _reset_ the `abortControllerRef` after the effect is done, otherwise the next effect will be aborted immediately.\n * For example, run `abortControllerRef.current = null` in a `finally` block or after an awaited promise.\n * @param abortControllerRef\n * @returns {AbortController}\n */\nexport function handleAbortRef(\n abortControllerRef: React.RefObject<AbortController>,\n): AbortController {\n const newController = new AbortController()\n\n if (abortControllerRef.current) {\n try {\n abortControllerRef.current.abort()\n } catch (_err) {\n // swallow error\n }\n }\n\n abortControllerRef.current = newController\n\n return newController\n}\n"],"mappings":"AAAA,OAAO,SAASA,eAAeC,eAAgC;EAC7D,IAAIA,eAAA,EAAiB;IACnB,IAAI;MACFA,eAAA,CAAgBC,KAAK;IACvB,EAAE,OAAOC,IAAA,EAAM;MACb;IAAA;EAEJ;AACF;AAEA;;;;;;;;AAQA,OAAO,SAASC,eACdC,kBAAoD;EAEpD,MAAMC,aAAA,GAAgB,IAAIC,eAAA;EAE1B,IAAIF,kBAAA,CAAmBG,OAAO,EAAE;IAC9B,IAAI;MACFH,kBAAA,CAAmBG,OAAO,CAACN,KAAK;IAClC,EAAE,OAAOC,IAAA,EAAM;MACb;IAAA;EAEJ;EAEAE,kBAAA,CAAmBG,OAAO,GAAGF,aAAA;EAE7B,OAAOA,aAAA;AACT","ignoreList":[]} |