fix mobx errors
This commit is contained in:
parent
50a1fb07cd
commit
6ac00c17d6
@ -1,7 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { gql } from '@apollo/client';
|
||||
import type * as CRMTypes from 'graphql/crm.types';
|
||||
import { autorun, reaction } from 'mobx';
|
||||
import { reaction } from 'mobx';
|
||||
import type { ReactionsContext } from 'process/types';
|
||||
import { intersects } from 'radash';
|
||||
import { normalizeOptions } from 'tools';
|
||||
@ -84,14 +84,18 @@ const QUERY_GET_CONFIGURATIONS = gql`
|
||||
export default function commonReactions({ store, apolloClient }: ReactionsContext) {
|
||||
const { $calculation } = store;
|
||||
|
||||
autorun(
|
||||
async () => {
|
||||
const {
|
||||
brand: brandId,
|
||||
subsidy: subsidyId,
|
||||
importProgram: importProgramId,
|
||||
leaseObjectType: leaseObjectTypeId,
|
||||
} = $calculation.$values.values;
|
||||
reaction(
|
||||
() => {
|
||||
const { brand, subsidy, importProgram, leaseObjectType } = $calculation.$values.values;
|
||||
|
||||
return {
|
||||
brandId: brand,
|
||||
subsidyId: subsidy,
|
||||
importProgramId: importProgram,
|
||||
leaseObjectTypeId: leaseObjectType,
|
||||
};
|
||||
},
|
||||
async ({ brandId, subsidyId, importProgramId, leaseObjectTypeId }) => {
|
||||
if (!brandId) {
|
||||
$calculation.element('selectModel').reset();
|
||||
|
||||
@ -201,21 +205,21 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex
|
||||
}
|
||||
|
||||
$calculation.element('selectModel').setOptions(normalizeOptions(models));
|
||||
},
|
||||
{
|
||||
delay: 10,
|
||||
}
|
||||
);
|
||||
|
||||
autorun(
|
||||
async () => {
|
||||
const {
|
||||
product: productId,
|
||||
subsidy: subsidyId,
|
||||
importProgram: importProgramId,
|
||||
leaseObjectType: leaseObjectTypeId,
|
||||
} = $calculation.$values.values;
|
||||
reaction(
|
||||
() => {
|
||||
const { product, subsidy, importProgram, leaseObjectType } = $calculation.$values.values;
|
||||
|
||||
return {
|
||||
productId: product,
|
||||
subsidyId: subsidy,
|
||||
importProgramId: importProgram,
|
||||
leaseObjectTypeId: leaseObjectType,
|
||||
};
|
||||
},
|
||||
async ({ productId, subsidyId, importProgramId, leaseObjectTypeId }) => {
|
||||
const {
|
||||
data: { evo_brands },
|
||||
} = await apolloClient.query<
|
||||
@ -345,9 +349,6 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex
|
||||
}
|
||||
|
||||
$calculation.element('selectBrand').setOptions(normalizeOptions(brands));
|
||||
},
|
||||
{
|
||||
delay: 10,
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user