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
3.2 KiB
Plaintext
1 line
3.2 KiB
Plaintext
{"version":3,"file":"useEffectEvent.js","names":["React","useCallback","useInsertionEffect","useRef","useEffectEvent","fn","ref","current","args","latestFn"],"sources":["../../src/hooks/useEffectEvent.ts"],"sourcesContent":["'use client'\n\n/**\n\nPolyfill taken and modified from https://github.com/bluesky-social/social-app/blob/ce0bf867ff3b50a495d8db242a7f55371bffeadc/src/lib/hooks/useNonReactiveCallback.ts\n\nCopyright 2023–2025 Bluesky PBC\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\nimport React, { useCallback, useInsertionEffect, useRef } from 'react'\n\n// This should be used sparingly. It erases reactivity, i.e. when the inputs\n// change, the function itself will remain the same. This means that if you\n// use this at a higher level of your tree, and then some state you read in it\n// changes, there is no mechanism for anything below in the tree to \"react\"\n// to this change (e.g. by knowing to call your function again).\n//\n// Also, you should avoid calling the returned function during rendering\n// since the values captured by it are going to lag behind.\n\nexport const useEffectEvent =\n 'useEffectEvent' in React && typeof React.useEffectEvent === 'function'\n ? // useEffectEvent is available in Next.js 16 / newer versions of React\n React.useEffectEvent\n : // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n <T extends Function>(fn: T): T => {\n // useEffectEvent is not available in older versions of React, so we need to polyfill it\n const ref = useRef(fn)\n useInsertionEffect(() => {\n ref.current = fn\n }, [fn])\n return useCallback((...args: any) => {\n const latestFn = ref.current\n return latestFn(...args)\n }, []) as unknown as T\n }\n"],"mappings":"AAAA;;AAEA;;;;;;;;;;;;AAaA,OAAOA,KAAA,IAASC,WAAW,EAAEC,kBAAkB,EAAEC,MAAM,QAAQ;AAE/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,OAAO,MAAMC,cAAA,GACX,oBAAoBJ,KAAA,IAAS,OAAOA,KAAA,CAAMI,cAAc,KAAK,aAEzDJ,KAAA,CAAMI,cAAc,GAECC,EAAA;EACnB;EACA,MAAMC,GAAA,GAAMH,MAAA,CAAOE,EAAA;EACnBH,kBAAA,CAAmB;IACjBI,GAAA,CAAIC,OAAO,GAAGF,EAAA;EAChB,GAAG,CAACA,EAAA,CAAG;EACP,OAAOJ,WAAA,CAAY,CAAC,GAAGO,IAAA;IACrB,MAAMC,QAAA,GAAWH,GAAA,CAAIC,OAAO;IAC5B,OAAOE,QAAA,IAAYD,IAAA;EACrB,GAAG,EAAE;AACP","ignoreList":[]} |