From 2a010d3f07e899db7feaa3b69a45d9c05bd68499 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Wed, 31 Jul 2024 23:16:44 -0400 Subject: [PATCH] Fix type error caused by `CurrencyRateController` `18.0.0` breaking change in state type - This was masked due to `any` typing of `datamodel` field of `Engine` class --- app/core/Engine.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/core/Engine.ts b/app/core/Engine.ts index 98c5968bfde..1f7c07e92c4 100644 --- a/app/core/Engine.ts +++ b/app/core/Engine.ts @@ -2036,10 +2036,12 @@ export default { // TODO: handle `null` currencyRate by hiding fiat values instead const modifiedCurrencyRateControllerState = { ...CurrencyRateController, - conversionRate: - CurrencyRateController.conversionRate === null - ? 0 - : CurrencyRateController.conversionRate, + currencyRates: Object.fromEntries( + Object.entries(CurrencyRateController.currencyRates).map(([k, v]) => [ + k, + { ...v, conversionRate: v.conversionRate ?? 0 }, + ]), + ), }; return {