Skip to content

Commit a3dd709

Browse files
author
wangyi
committed
## v3.4.0 2021-06-01
* [优化] 针对 `agent-reducer@3.4.1` 作出代码调整
1 parent fb8a39b commit a3dd709

File tree

5 files changed

+23
-14
lines changed

5 files changed

+23
-14
lines changed

docs/changes.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,8 @@
1818

1919
## v3.3.2 2021-05-24
2020

21-
* [bug] fix the problem about `useAgentMethods` can not update the state itself.
21+
* [bug] fix the problem about `useAgentMethods` can not update the state itself.
22+
23+
## v3.4.0 2021-06-01
24+
25+
* [refactor] adjust by `agent-reducer@3.4.1` .

docs/zh/changes.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,8 @@
1818

1919
## v3.3.2 2021-05-24
2020

21-
* [bug] 修复 `useAgentMethods` 不能更新 state 的问题。
21+
* [bug] 修复 `useAgentMethods` 不能更新 state 的问题。
22+
23+
## v3.4.0 2021-06-01
24+
25+
* [优化] 针对 `agent-reducer@3.4.1` 作出代码调整

example/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"moment": "^2.24.0",
2020
"classnames": "^2.2.6",
2121
"babel-polyfill": "^6.26.0",
22-
"agent-reducer": "3.2.7",
23-
"use-agent-reducer": "3.2.8"
22+
"agent-reducer": "3.4.1",
23+
"use-agent-reducer": "3.4.0"
2424
},
2525
"devDependencies": {
2626
"@babel/core": "7.2.2",

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "use-agent-reducer",
3-
"version": "3.3.2",
3+
"version": "3.4.0",
44
"main": "./index.js",
55
"author": "Jimmy.Harding",
66
"description": "the purpose of this project is make useReducer classify",
@@ -40,10 +40,10 @@
4040
"peerDependencies": {
4141
"react": ">=16.8.0",
4242
"react-dom": ">=16.8.0",
43-
"agent-reducer": ">=3.2.4"
43+
"agent-reducer": ">=3.4.1"
4444
},
4545
"dependencies": {
46-
"agent-reducer": ">=3.2.4"
46+
"agent-reducer": ">=3.4.1"
4747
},
4848
"devDependencies": {
4949
"@babel/cli": "^7.13.16",

src/index.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ import {
1414
OriginAgent,
1515
useMiddleActions as useAgentMiddleActions,
1616
useMiddleWare as useAgentMiddleWare,
17+
LifecycleMiddleWare,
18+
MiddleActions,
19+
Action,
20+
AgentReducer,
1721
} from 'agent-reducer';
18-
import { LifecycleMiddleWare } from 'agent-reducer/libs/global.type';
19-
import { MiddleActions } from 'agent-reducer/libs/middleActions';
20-
import { Action, AgentReducer } from 'agent-reducer/libs/reducer.type';
2122

2223
export type Listener = (agent: OriginAgent) => any;
2324

@@ -69,7 +70,7 @@ export function useAgentReducer<T extends OriginAgent<S>, S>(
6970

7071
const middleWare = typeof middleWareOrEnv === 'function' ? middleWareOrEnv : undefined;
7172

72-
const reducerRef = useRef<null | AgentReducer<S, Action, T>>(null);
73+
const reducerRef = useRef<null | AgentReducer<S, T>>(null);
7374

7475
if (reducerRef.current === null) {
7576
reducerRef.current = createAgentReducer(entry, middleWare, {
@@ -118,7 +119,7 @@ export function useAgentSelector<T extends OriginAgent<S>, S, R>(
118119
mapStateCallback: (state: T['state']) => R,
119120
equalityFn?:(prev: R, current: R)=>boolean,
120121
): R {
121-
const reducerRef = useRef<null | AgentReducer<S, Action, T>>(null);
122+
const reducerRef = useRef<null | AgentReducer<S, T>>(null);
122123

123124
if (reducerRef.current === null) {
124125
reducerRef.current = createAgentReducer(entry, {
@@ -174,7 +175,7 @@ export function useAgentMethods<T extends OriginAgent<S>, S>(
174175

175176
const middleWare = typeof middleWareOrEnv === 'function' ? middleWareOrEnv : undefined;
176177

177-
const reducerRef = useRef<null | AgentReducer<S, Action, T>>(null);
178+
const reducerRef = useRef<null | AgentReducer<S, T>>(null);
178179

179180
if (reducerRef.current === null) {
180181
reducerRef.current = createAgentReducer(entry, middleWare, {
@@ -246,7 +247,7 @@ export function useAgent<T extends OriginAgent<S>, S>(
246247

247248
const middleWare = typeof middleWareOrEnv === 'function' ? middleWareOrEnv : undefined;
248249

249-
const reducerRef = useRef<null | AgentReducer<S, Action, T>>(null);
250+
const reducerRef = useRef<null | AgentReducer<S, T>>(null);
250251

251252
if (reducerRef.current === null) {
252253
reducerRef.current = createAgentReducer(entry, middleWare, {

0 commit comments

Comments
 (0)