extra-react-hooks 0.5.3 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ import { AbortController } from 'extra-abort';
4
4
  const abort = Symbol();
5
5
  export function useCallbackAsync(callback, deps) {
6
6
  const controller = useMemo(() => new AbortController(), deps);
7
- useEffect(() => () => controller.abort(abort), deps);
7
+ useEffect(() => () => controller.abort(abort), [controller]);
8
8
  return useCallback((...args) => {
9
9
  go(async () => {
10
10
  try {
@@ -15,6 +15,6 @@ export function useCallbackAsync(callback, deps) {
15
15
  throw err;
16
16
  }
17
17
  });
18
- }, deps);
18
+ }, [callback, controller]);
19
19
  }
20
20
  //# sourceMappingURL=use-callback-async.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-callback-async.js","sourceRoot":"","sources":["../src/use-callback-async.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAkB,MAAM,OAAO,CAAA;AACvE,OAAO,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C,MAAM,KAAK,GAAG,MAAM,EAAE,CAAA;AAEtB,MAAM,UAAU,gBAAgB,CAC9B,QAA0E,EAC1E,IAAoB;IAEpB,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,eAAe,EAAE,EAAE,IAAI,CAAC,CAAA;IAC7D,SAAS,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAA;IAEpD,OAAO,WAAW,CAAC,CAAC,GAAG,IAAU,EAAE,EAAE;QACnC,EAAE,CAAC,KAAK,IAAI,EAAE;YACZ,IAAI;gBACF,MAAM,QAAQ,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAA;aAC3C;YAAC,OAAO,GAAG,EAAE;gBACZ,IAAI,GAAG,KAAK,KAAK;oBAAE,MAAM,GAAG,CAAA;aAC7B;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,EAAE,IAAI,CAAC,CAAA;AACV,CAAC"}
1
+ {"version":3,"file":"use-callback-async.js","sourceRoot":"","sources":["../src/use-callback-async.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAkB,MAAM,OAAO,CAAA;AACvE,OAAO,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C,MAAM,KAAK,GAAG,MAAM,EAAE,CAAA;AAEtB,MAAM,UAAU,gBAAgB,CAC9B,QAA0E,EAC1E,IAAoB;IAEpB,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,eAAe,EAAE,EAAE,IAAI,CAAC,CAAA;IAC7D,SAAS,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAA;IAE5D,OAAO,WAAW,CAAC,CAAC,GAAG,IAAU,EAAE,EAAE;QACnC,EAAE,CAAC,KAAK,IAAI,EAAE;YACZ,IAAI;gBACF,MAAM,QAAQ,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAA;aAC3C;YAAC,OAAO,GAAG,EAAE;gBACZ,IAAI,GAAG,KAAK,KAAK;oBAAE,MAAM,GAAG,CAAA;aAC7B;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAA;AAC5B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "extra-react-hooks",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "files": [
@@ -34,19 +34,19 @@
34
34
  }
35
35
  },
36
36
  "devDependencies": {
37
- "@blackglory/wait-for": "^0.7.3",
38
- "@commitlint/cli": "^17.6.1",
39
- "@commitlint/config-conventional": "^17.6.1",
37
+ "@blackglory/wait-for": "^0.7.4",
38
+ "@commitlint/cli": "^17.6.5",
39
+ "@commitlint/config-conventional": "^17.6.5",
40
40
  "@testing-library/react": "^14.0.0",
41
- "@types/jasmine": "^4.3.1",
42
- "@types/react": "^18.0.35",
43
- "@typescript-eslint/eslint-plugin": "^5.58.0",
44
- "@typescript-eslint/parser": "^5.58.0",
45
- "eslint": "^8.38.0",
41
+ "@types/jasmine": "^4.3.2",
42
+ "@types/react": "^18.2.11",
43
+ "@typescript-eslint/eslint-plugin": "^5.59.9",
44
+ "@typescript-eslint/parser": "^5.59.9",
45
+ "eslint": "^8.42.0",
46
46
  "eslint-plugin-react-hooks": "^4.6.0",
47
47
  "husky": "4",
48
- "karma": "^6.4.1",
49
- "karma-chrome-launcher": "^3.1.1",
48
+ "karma": "^6.4.2",
49
+ "karma-chrome-launcher": "^3.2.0",
50
50
  "karma-jasmine": "^5.1.0",
51
51
  "karma-webpack": "^5.0.0",
52
52
  "npm-run-all": "^4.1.5",
@@ -55,19 +55,19 @@
55
55
  "react-test-renderer": "^18.2.0",
56
56
  "rimraf": "^4.3.0",
57
57
  "standard-version": "^9.3.2",
58
- "ts-loader": "^9.4.2",
58
+ "ts-loader": "^9.4.3",
59
59
  "ts-patch": "^2.1.0",
60
60
  "tsconfig-paths-webpack-plugin": "^4.0.1",
61
- "tslib": "^2.4.1",
61
+ "tslib": "^2.5.3",
62
62
  "typescript": "4.9.5",
63
63
  "typescript-transform-paths": "^3.4.6",
64
- "webpack": "^5.79.0"
64
+ "webpack": "^5.86.0"
65
65
  },
66
66
  "dependencies": {
67
- "@blackglory/prelude": "^0.3.2",
68
- "extra-abort": "^0.3.6",
69
- "extra-fsm": "^0.2.0",
70
- "rxjs": "^7.8.0"
67
+ "@blackglory/prelude": "^0.3.3",
68
+ "extra-abort": "^0.3.7",
69
+ "extra-fsm": "^0.2.1",
70
+ "rxjs": "^7.8.1"
71
71
  },
72
72
  "peerDependencies": {
73
73
  "react": "^16.8 || ^17 || ^18"
@@ -9,7 +9,7 @@ export function useCallbackAsync<Args extends unknown[]>(
9
9
  , deps: DependencyList
10
10
  ): (...args: Args) => void {
11
11
  const controller = useMemo(() => new AbortController(), deps)
12
- useEffect(() => () => controller.abort(abort), deps)
12
+ useEffect(() => () => controller.abort(abort), [controller])
13
13
 
14
14
  return useCallback((...args: Args) => {
15
15
  go(async () => {
@@ -19,5 +19,5 @@ export function useCallbackAsync<Args extends unknown[]>(
19
19
  if (err !== abort) throw err
20
20
  }
21
21
  })
22
- }, deps)
22
+ }, [callback, controller])
23
23
  }