@mic-rexjs/usecases-react 2.3.1 → 2.3.2
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.
- package/dist/index.min.js +1 -1
- package/es/hooks/useCompareDeps/index.d.ts +1 -1
- package/es/hooks/useContextualItem/index.d.ts +1 -1
- package/es/hooks/useContextualItem/index.js +12 -4
- package/es/hooks/useEntity/index.d.ts +1 -1
- package/es/hooks/useEntity/index.js +16 -13
- package/es/hooks/useUseCase/index.js +4 -2
- package/es/hooks/useUseCase/index.test.js +271 -149
- package/es/hooks/useUseCase/types.d.ts +1 -1
- package/lib/hooks/useContextualItem/index.js +11 -3
- package/lib/hooks/useEntity/index.js +16 -14
- package/lib/hooks/useUseCase/index.js +4 -2
- package/lib/hooks/useUseCase/index.test.js +487 -314
- package/package.json +3 -3
- package/es/hooks/useMemoizedCall/index.d.ts +0 -2
- package/es/hooks/useMemoizedCall/index.js +0 -15
- package/lib/hooks/useMemoizedCall/index.js +0 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mic-rexjs/usecases-react",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2",
|
|
4
4
|
"description": "React-based solution for use usecases of Clean Architecture",
|
|
5
5
|
"private": false,
|
|
6
6
|
"keywords": [
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@mic-rexjs/usecases": "^2.
|
|
36
|
+
"@mic-rexjs/usecases": "^2.7.5",
|
|
37
37
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@commitlint/cli": "^19.0.3",
|
|
50
50
|
"@commitlint/config-angular": "^19.0.3",
|
|
51
51
|
"@jest/globals": "^29.5.0",
|
|
52
|
-
"@mic-rexjs/usecases": "^2.
|
|
52
|
+
"@mic-rexjs/usecases": "^2.7.5",
|
|
53
53
|
"@testing-library/react": "^14.0.0",
|
|
54
54
|
"@types/node": "^20.4.2",
|
|
55
55
|
"@types/react": "^18.2.14",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { useCreation, useLatest } from 'ahooks';
|
|
2
|
-
import { useCompareDeps } from '../useCompareDeps';
|
|
3
|
-
import { cacheCall } from '../../methods/cacheCall';
|
|
4
|
-
export const useMemoizedCall = (factory, deps) => {
|
|
5
|
-
const depsKey = useCompareDeps(deps);
|
|
6
|
-
const factoryRef = useLatest(factory);
|
|
7
|
-
return useCreation(() => {
|
|
8
|
-
void depsKey;
|
|
9
|
-
return cacheCall(factoryRef.current, {
|
|
10
|
-
onCompare() {
|
|
11
|
-
return true;
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
|
-
}, [depsKey, factoryRef]);
|
|
15
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useMemoizedCall = void 0;
|
|
7
|
-
var _ahooks = require("ahooks");
|
|
8
|
-
var _useCompareDeps = require("../useCompareDeps");
|
|
9
|
-
var _cacheCall = require("../../methods/cacheCall");
|
|
10
|
-
var useMemoizedCall = exports.useMemoizedCall = function useMemoizedCall(factory, deps) {
|
|
11
|
-
var depsKey = (0, _useCompareDeps.useCompareDeps)(deps);
|
|
12
|
-
var factoryRef = (0, _ahooks.useLatest)(factory);
|
|
13
|
-
return (0, _ahooks.useCreation)(function () {
|
|
14
|
-
void depsKey;
|
|
15
|
-
return (0, _cacheCall.cacheCall)(factoryRef.current, {
|
|
16
|
-
onCompare: function onCompare() {
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}, [depsKey, factoryRef]);
|
|
21
|
-
};
|