From 44f3829fe315ad35aa21e03e2504f6941dcada8a Mon Sep 17 00:00:00 2001 From: Ramiro Medina <64783088+ramedina86@users.noreply.github.com> Date: Mon, 30 Sep 2024 13:02:27 +0000 Subject: [PATCH] fix: Default inside JSON parsing --- src/ui/src/renderer/useEvaluator.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/src/renderer/useEvaluator.ts b/src/ui/src/renderer/useEvaluator.ts index f1bbcd770..69c6199b8 100644 --- a/src/ui/src/renderer/useEvaluator.ts +++ b/src/ui/src/renderer/useEvaluator.ts @@ -174,7 +174,7 @@ export function useEvaluator(wf: Core) { try { parsedValue = JSON.parse(evaluated); } catch { - return JSON.parse(defaultValue) ?? null; + return JSON.parse(defaultValue ?? null); } return parsedValue; } else if (fieldType == FieldType.Number) { @@ -183,7 +183,7 @@ export function useEvaluator(wf: Core) { if (isValueEmpty) return floatDefaultValue ?? null; const n = parseFloat(evaluated); - if (typeof n === undefined || Number.isNaN(n)) + if (typeof n === "undefined" || Number.isNaN(n)) return floatDefaultValue ?? null; return n; } else if (fieldType == FieldType.IdKey) {