From e544774c6b78bd25dbadf23ebb97e4dc25d17be7 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Mon, 16 Nov 2020 11:10:03 +0300 Subject: [PATCH] refactor #2 --- src/client/stores/CalculationStore/index.ts | 5 +---- src/core/types/Calculation/Store/effect.ts | 9 +++------ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/client/stores/CalculationStore/index.ts b/src/client/stores/CalculationStore/index.ts index 30ace45..7b1b437 100644 --- a/src/client/stores/CalculationStore/index.ts +++ b/src/client/stores/CalculationStore/index.ts @@ -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); diff --git a/src/core/types/Calculation/Store/effect.ts b/src/core/types/Calculation/Store/effect.ts index 06d7b82..cbc89f7 100644 --- a/src/core/types/Calculation/Store/effect.ts +++ b/src/core/types/Calculation/Store/effect.ts @@ -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; };