From ecf6a0529cb2036eeab2ace844190e4549525574 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Thu, 24 Nov 2022 09:16:05 +0100 Subject: [PATCH] fix flow UX --- .../lib/components/InputTransformForm.svelte | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/frontend/src/lib/components/InputTransformForm.svelte b/frontend/src/lib/components/InputTransformForm.svelte index 297247c4e3..3b972de968 100644 --- a/frontend/src/lib/components/InputTransformForm.svelte +++ b/frontend/src/lib/components/InputTransformForm.svelte @@ -26,13 +26,13 @@ let inputCat: InputCat = 'object' let propertyType = getPropertyType(arg) - $: isStaticTemplate(inputCat) && arg.expr && (arg.value = codeToStaticTemplate(arg.expr)) - function getPropertyType(arg: InputTransform | any): 'static' | 'javascript' { let type: 'static' | 'javascript' = arg?.type ?? 'static' if (type == 'javascript') { - if (codeToStaticTemplate(arg.expr)) { + const newValue = codeToStaticTemplate(arg.expr) + if (newValue) { type = 'static' + arg.value = newValue } } return type @@ -44,7 +44,6 @@ } if (isCodeInjection(rawValue)) { - console.log(rawValue) arg.expr = getDefaultExpr(argName, previousModuleId, `\`${rawValue}\``) arg.type = 'javascript' propertyType = 'static' @@ -139,14 +138,15 @@ propertyType = 'javascript' arg.type = 'javascript' } else { - arg.value = staticTemplate ? codeToStaticTemplate(arg.expr) : undefined - arg.expr = undefined - propertyType = 'static' - if (!isStaticTemplate) { - arg.type = 'static' - } else { + if (staticTemplate) { + arg.value = codeToStaticTemplate(arg.expr) setPropertyType(arg.value) + } else { + arg.type = 'static' + arg.value = undefined + arg.expr = undefined } + propertyType = 'static' } }} >