From 0cf19c9c029d6925c3ad56a903de06ff68e04819 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Wed, 8 Feb 2023 10:20:21 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=D0=BF=D0=BB=D0=B0=D1=82=D0=B5=D0=B6?= =?UTF-8?q?=D0=B8=20-=20=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B6=D0=B0=D0=B5?= =?UTF-8?q?=D0=BC=20=D0=9A=D0=9F=20=D0=A1=D0=B5=D0=B2=D0=B5=D1=80=D1=82?= =?UTF-8?q?=D1=80=D0=B0=D0=BD=D1=81=20380=20=D1=81=20=D0=B4=D0=B5=D0=B3?= =?UTF-8?q?=D1=80=D0=B5=D1=81=D1=81=D0=B8=D0=B5=D0=B9,=20=D0=BF=D0=BE?= =?UTF-8?q?=D1=82=D0=BE=D0=BC=20=D0=B2=D1=8B=D0=B1=D0=B8=D1=80=D0=B0=D0=B5?= =?UTF-8?q?=D0=BC=20=D0=B3=D0=B8=D0=B1=D0=BA=D1=83=D1=8E=20=D0=B8=20=D0=BF?= =?UTF-8?q?=D0=BB=D0=B0=D1=82=D0=B5=D0=B6=D0=B8=20=D0=B7=D0=B0=D0=BF=D0=BE?= =?UTF-8?q?=D0=BB=D0=BD=D1=8F=D1=8E=D1=82=D1=81=D1=8F=20=D0=BF=D1=83=D1=81?= =?UTF-8?q?=D1=82=D1=8B=D0=BC=D0=B8=20=D0=B7=D0=BD=D0=B0=D1=87=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/process/payments/reactions.ts | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/apps/web/process/payments/reactions.ts b/apps/web/process/payments/reactions.ts index c215858..9926415 100644 --- a/apps/web/process/payments/reactions.ts +++ b/apps/web/process/payments/reactions.ts @@ -353,26 +353,19 @@ export default function paymentsReactions({ store }: ReactionsContext) { makeDisposable( () => reaction( - () => { + () => toJS($tables.payments.values), + (nextPayments, prevPayments) => { const graphType = $calculation.element('radioGraphType').getValue(); - const payments = toJS($tables.payments.values); const degressionType = $calculation.element('selectSeasonType').getValue(); - return { - degressionType, - graphType, - payments, - }; - }, - (nextParams, prevParams) => { - if (nextParams.graphType === 100_000_001 && nextParams.degressionType === 100_000_007) { - const changes = difference(nextParams.payments, prevParams.payments); + if (graphType === 100_000_001 && degressionType === 100_000_007) { + const changes = difference(nextPayments, prevPayments); - if (changes === null || changes.length > 1) return; + if (!changes?.length || changes.length > 1) return; const [changeIndex] = changes; - const value = nextParams.payments[changeIndex]; - const payments = nextParams.payments.slice(1, -1).map((payment, i) => { + const value = nextPayments[changeIndex]; + const payments = nextPayments.slice(1, -1).map((payment, i) => { if (i <= changeIndex - 2) return payment; return value;