more code

This commit is contained in:
developer committed 2026-09-27 11:34:26 +00:00
1 parent f24fd63e9a
commit ee72257c64
29 files changed
+5636 -440

No files matched your search

+3 -2
View File
@@ -27,7 +27,9 @@ export function useApi<T>(fn: () => Promise<T>, deps: unknown[] = []): ApiState<
fnRef.current = fn
useEffect(() => {
const controller = new AbortController()
// The fetcher takes no AbortSignal, so cancellation is a guard: a response
// that arrives after an unmount or a newer request is dropped on the floor
// instead of overwriting fresher state.
let live = true
setLoading(true)
@@ -50,7 +52,6 @@ export function useApi<T>(fn: () => Promise<T>, deps: unknown[] = []): ApiState<
return () => {
live = false
controller.abort()
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [...deps, nonce])