From 2fa8b67a8489e1eaa8738a25331ebded9289450a Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Wed, 28 Feb 2024 17:21:06 +0100 Subject: [PATCH] nit --- frontend/src/lib/components/apps/components/helpers/eval.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/lib/components/apps/components/helpers/eval.ts b/frontend/src/lib/components/apps/components/helpers/eval.ts index 3a39d2b2f8..20689326c9 100644 --- a/frontend/src/lib/components/apps/components/helpers/eval.ts +++ b/frontend/src/lib/components/apps/components/helpers/eval.ts @@ -23,7 +23,7 @@ function create_context_function_template( contextKeys: string[], noReturn: boolean ) { - let hasReturnAsLastLine = eval_string.split('\n').some((x) => x.startsWith('return ')) + let hasReturnAsLastLine = noReturn || eval_string.split('\n').some((x) => x.startsWith('return ')) return ` return async function (context, state, goto, setTab, recompute, getAgGrid, setValue, setSelectedIndex, openModal, closeModal, open, close, validate, invalidate, validateAll, clearFiles, showToast) { "use strict"; @@ -33,7 +33,7 @@ ${ : `` } ${ - hasReturnAsLastLine || noReturn + hasReturnAsLastLine ? eval_string : ` return ${eval_string.startsWith('return ') ? eval_string.substring(7) : eval_string}` @@ -65,7 +65,7 @@ type WmFunctor = ( let functorCache: Record = {} function make_context_evaluator(eval_string, contextKeys: string[], noReturn: boolean): WmFunctor { - let cacheKey = hashCode(JSON.stringify({ eval_string, contextKeys })) + let cacheKey = hashCode(JSON.stringify({ eval_string, contextKeys, noReturn })) if (functorCache[cacheKey]) { return functorCache[cacheKey] }