From ff3ffbf908a2eef26a8d8da37c54a3f610445365 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Wed, 30 Aug 2023 17:26:30 +0200 Subject: [PATCH] nits --- .../src/lib/components/apps/components/helpers/eval.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/src/lib/components/apps/components/helpers/eval.ts b/frontend/src/lib/components/apps/components/helpers/eval.ts index 36c36845c6..d953eefded 100644 --- a/frontend/src/lib/components/apps/components/helpers/eval.ts +++ b/frontend/src/lib/components/apps/components/helpers/eval.ts @@ -18,7 +18,7 @@ export function computeGlobalContext(world: World | undefined, extraContext: any } } -function create_context_function_template(eval_string, context, noReturn: boolean) { +function create_context_function_template(eval_string: string, context, noReturn: boolean) { return ` return async function (context, state, goto, setTab, recompute, getAgGrid, setValue, setSelectedIndex, openModal, closeModal) { "use strict"; @@ -27,7 +27,11 @@ ${ ? `let ${Object.keys(context).map((key) => ` ${key} = context['${key}']`)};` : `` } -${noReturn ? `return ${eval_string}` : eval_string} +${ + noReturn + ? `return ${eval_string.startsWith('return ') ? eval_string.substring(7) : eval_string}` + : eval_string +} } ` }