remove async in store

This commit is contained in:
Владислав Чикалкин 2020-08-31 18:09:47 +03:00
parent 5336d39952
commit 5f479c1fb6
3 changed files with 10 additions and 12 deletions

View File

@ -29,11 +29,11 @@ const Input = ({
// set Value to global store and run Effects
useEffect(() => {
if (sourceValueName && debouncedValue) {
calculationStore.setValue(sourceValueName, debouncedValue).then(() => {
if (Effects && Effects.length > 0) {
runEffects(Effects, calculationStore);
}
});
calculationStore.setValue(sourceValueName, debouncedValue);
}
if (Effects && Effects.length > 0) {
runEffects(Effects, calculationStore);
}
}, [debouncedValue]);

View File

@ -2,7 +2,7 @@ import React from "react";
import { Flex } from "client/UIKit/grid";
const withTitle = (title) => (Component) => (props) => (
<Flex>
<Flex flexDirection="column">
<div>{title}</div>
<Component {...props} />
</Flex>

View File

@ -10,12 +10,10 @@ class CalculationStore {
getValue = (sourceValueName: SourceValueNames) =>
this.values[sourceValueName];
setValue = action(
async (sourceValueName: SourceValueNames, newValue: any) => {
this.values[sourceValueName] = newValue;
// TODO: Run effect here
}
);
setValue = action((sourceValueName: SourceValueNames, newValue: any) => {
this.values[sourceValueName] = newValue;
// TODO: Run effect here
});
getStatus = (elementName: string) => this.statuses[elementName];
setStatus = action((elementName: string, status: Status) => {