refactor #2
This commit is contained in:
parent
ca69b4a32e
commit
e544774c6b
@ -7,7 +7,6 @@ import actionsEffects from 'client/stores/CalculationStore/Effects/action';
|
||||
import { ICalculationStore } from 'core/types/Calculation/Store';
|
||||
import { isEqual } from 'lodash';
|
||||
import { autorun, makeAutoObservable, reaction, when } from 'mobx';
|
||||
import CommonStore from '../CommonStore';
|
||||
import {
|
||||
tablesActions,
|
||||
tablesData,
|
||||
@ -38,9 +37,7 @@ const CalculationStore: ICalculationStore = makeAutoObservable(
|
||||
),
|
||||
);
|
||||
|
||||
autorunEffects.map(autorunEffect =>
|
||||
autorun(autorunEffect(CalculationStore, CommonStore)),
|
||||
);
|
||||
autorunEffects.map(autorunEffect => autorun(autorunEffect(CalculationStore)));
|
||||
|
||||
reactionEffects.map(reactionEffectBuilder => {
|
||||
const reactionEffect = reactionEffectBuilder(CalculationStore);
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
import CommonStore from 'client/stores/CommonStore';
|
||||
import { IReactionOptions, IReactionPublic, Lambda } from 'mobx';
|
||||
import { ICalculationStore } from './';
|
||||
|
||||
type TCommonStore = typeof CommonStore;
|
||||
|
||||
export type ActionsNames = 'createLead' | 'calculate' | 'createKP';
|
||||
|
||||
export type TAction = {
|
||||
@ -11,11 +8,11 @@ export type TAction = {
|
||||
};
|
||||
|
||||
export interface IAutorunEffect {
|
||||
(CalculationStore: ICalculationStore, CommonStore?: TCommonStore): () => void;
|
||||
(CalculationStore: ICalculationStore): () => void;
|
||||
}
|
||||
|
||||
export interface IReactionEffect {
|
||||
(CalculationStore: ICalculationStore, CommonStore?: TCommonStore): {
|
||||
(CalculationStore: ICalculationStore): {
|
||||
expression: (r: IReactionPublic) => any;
|
||||
effect: (arg: any, prev: any, r: IReactionPublic) => void;
|
||||
options?: IReactionOptions;
|
||||
@ -23,7 +20,7 @@ export interface IReactionEffect {
|
||||
}
|
||||
|
||||
export interface IWhenEffect {
|
||||
(CalculationStore: ICalculationStore, CommonStore?: TCommonStore): {
|
||||
(CalculationStore: ICalculationStore): {
|
||||
predicate: () => boolean;
|
||||
effect: Lambda;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user