From 7f9673e79c527122ccdbf9ed2c38a75351cbbda5 Mon Sep 17 00:00:00 2001 From: Chika Date: Tue, 8 Jun 2021 13:40:52 +0300 Subject: [PATCH] fix run selectModel filter reaction --- .../Effects/reactions/otherReactions.ts | 56 ++++++++++--------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts index 2148a5f..7312710 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts @@ -1686,34 +1686,33 @@ const reactionEffects: IReactionEffect[] = [ leaseObjectType ? ElementStatus.Default : ElementStatus.Disabled, ); - if (calculationStore.getOptions('selectBrand')) - calculationStore.setFilter('selectBrand', options => - options.filter( - compose( - option => { - if ( - product && - product.evo_brands && - product.evo_brands.length > 0 - ) { - return ( - product.evo_brands - .map(x => x.evo_brandid) - .includes(option.evo_brandid) && option - ); - } - return option; - }, + calculationStore.setFilter('selectBrand', options => + options.filter( + compose( + option => { + if ( + product && + product.evo_brands && + product.evo_brands.length > 0 + ) { + return ( + product.evo_brands + .map(x => x.evo_brandid) + .includes(option.evo_brandid) && option + ); + } + return option; + }, - option => - option.evo_vehicle_type && - intersection( - option.evo_vehicle_type?.filter(x => x > 0), - leaseObjectType.evo_vehicle_type, - ).length > 0, - ), + option => + option.evo_vehicle_type && + intersection( + option.evo_vehicle_type?.filter(x => x > 0), + leaseObjectType.evo_vehicle_type, + ).length > 0, ), - ); + ), + ); }, options: { fireImmediately: true, @@ -1722,7 +1721,10 @@ const reactionEffects: IReactionEffect[] = [ calculationStore => ({ expression: () => { - return calculationStore.getOption('selectBrand'); + return { + selectBrandOptions: calculationStore.getOption('selectBrand'), + selectBrandFilter: calculationStore.getFilter('selectBrand'), + }; }, effect: () => { const leaseObjectType = calculationStore.getOption(