PageSourceSearch

https://kuto.app/static/useResettableState-Ds-O-ieJ.js

js kuto.app collected 2026-10-07 04:05:57 UTC 871 bytes, 29 lines download raw bytes

1import { r as reactExports } from "./index-B4tqMR8N.js";
2function useResettableState(initial, deps) {
3  const [innerValue, setInnerValue] = reactExports.useState(initial);
4  const [prevDeps, setPrevDeps] = reactExports.useState(deps);
5  if (depsChanged(deps, prevDeps)) {
6    setPrevDeps(deps);
7    setInnerValue(initial);
8  }
9  return [innerValue, setInnerValue];
10}
11function depsChanged(previous, current) {
12  if (previous === void 0 && current === void 0)
13    return false;
14  if (previous === void 0 || current === void 0)
15    return true;
16  if (previous.length !== current.length) {
17    console.error("useResettableState(): Dependency array size changed between renders!");
18    return false;
19  }
20  for (let i = 0; i < previous.length; i += 1) {
21    if (previous[i] !== current[i]) {
22      return true;
23    }
24  }
25  return false;
26}
27export {
28  useResettableState as u
29};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.