Skip to content

Commit 7ecf352

Browse files
committed
fix(type): fix type and add port id
1 parent e96a11e commit 7ecf352

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

packages/reactant-model/src/model.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
nameKey,
1111
strictKey,
1212
Patch,
13+
Patches,
1314
} from 'reactant-module';
1415

1516
interface Scheme<S, A> {
@@ -34,8 +35,8 @@ export const model = <
3435
Object.assign(scheme.actions, {
3536
[key]: (...args: any[]) => {
3637
let state: Immutable<S> | S | undefined;
37-
let patches: Patch[] | undefined;
38-
let inversePatches: Patch[] | undefined;
38+
let patches: Patches | undefined;
39+
let inversePatches: Patches | undefined;
3940
if (module[enablePatchesKey]) {
4041
[state, patches, inversePatches] = create(
4142
module[stateKey] as S,

packages/reactant-module/src/decorators/action.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable no-console */
22
/* eslint-disable func-names */
33
import { create } from 'mutative';
4-
import { Patch, ReactantAction, Service } from '../interfaces';
4+
import { Patch, Patches, ReactantAction, Service } from '../interfaces';
55
import {
66
storeKey,
77
actionIdentifier,
@@ -67,8 +67,8 @@ const action = (
6767
try {
6868
const lastState = this[storeKey]?.getState();
6969
let state: Record<string, unknown>;
70-
let patches: Patch[] | undefined;
71-
let inversePatches: Patch[] | undefined;
70+
let patches: Patches | undefined;
71+
let inversePatches: Patches | undefined;
7272
if (this[enablePatchesKey]) {
7373
[state, patches, inversePatches] = create(
7474
lastState,

packages/reactant-module/src/interfaces.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ export interface ReactantAction<T = any> extends Action<string | symbol> {
109109
state: Record<string, T>;
110110
params: any[];
111111
_reactant: typeof actionIdentifier;
112-
_patches?: Patch[];
113-
_inversePatches?: Patch[];
112+
_patches?: Patches;
113+
_inversePatches?: Patches;
114114
}
115115

116116
export type StateMapObject<T extends Record<string, Function>> = {

packages/reactant-share/src/portDetector.ts

+4
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ export class PortDetector {
9999
});
100100
}
101101

102+
get id() {
103+
return this.clientId ?? '__SERVER__';
104+
}
105+
102106
get shared() {
103107
return !!(this.sharedAppOptions.port && this.sharedAppOptions.type);
104108
}

0 commit comments

Comments
 (0)