From 525d38eec366a690c4d1a6f7c9e230498c6db718 Mon Sep 17 00:00:00 2001 From: Roie Natan Date: Sun, 8 Nov 2020 12:26:42 +0200 Subject: [PATCH] fix modal service nesting ; remove unnecessary console log --- src/arc.ts | 1 - src/lib/proposalUtils.ts | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/arc.ts b/src/arc.ts index fe2847b5..137eea72 100644 --- a/src/arc.ts +++ b/src/arc.ts @@ -127,7 +127,6 @@ export async function initializeArc(provider?: Web3Provider): Promise { return (count !== 10); }, delay: () => { - console.log(Math.floor(Math.random() * (30000 - 5000 + 1) + 5000)); // This will give a random delay between retries between the range of 5 to 30 seconds. return Math.floor(Math.random() * (30000 - 5000 + 1) + 5000); }, diff --git a/src/lib/proposalUtils.ts b/src/lib/proposalUtils.ts index e1519780..1397d5da 100644 --- a/src/lib/proposalUtils.ts +++ b/src/lib/proposalUtils.ts @@ -80,9 +80,8 @@ export function restoreModalFormEntries(name: string): { [key: string]: any } { if (valuesString) { sessionStorage.removeItem(formValuesKey(name)); try { - const values = JSON.parse(valuesString); - - const processValue = (key: string): void => { + const rootValues = JSON.parse(valuesString); + const processValue = (values: { [key: string]: any }, key: string): void => { const value = values[key]; // Moment interprets something like "100" as a date if (typeof value === "string" && isNaN(value as any)) { @@ -90,17 +89,18 @@ export function restoreModalFormEntries(name: string): { [key: string]: any } { if (date?.isValid()) { values[key] = date; } + } else if (typeof value === "object") { + Object.keys(value).map((key: string) => processValue(value, key)); } }; /** * convert ISO date/time strings to Moment object */ - Object.keys(values).map(processValue); - return values; + Object.keys(rootValues).map((key: string) => processValue(rootValues, key)); + return rootValues; } // eslint-disable-next-line no-empty catch { } } - return {}; }