diff --git a/src-web/components/TemplateFunctionDialog.tsx b/src-web/components/TemplateFunctionDialog.tsx index da2c8491..21767047 100644 --- a/src-web/components/TemplateFunctionDialog.tsx +++ b/src-web/components/TemplateFunctionDialog.tsx @@ -190,7 +190,7 @@ function InitializedTemplateFunctionDialog({ /> )} -
+
{previewType !== 'none' ? (
diff --git a/src-web/components/core/Editor/twig/templateTags.ts b/src-web/components/core/Editor/twig/templateTags.ts index 2cca0852..273ec5c1 100644 --- a/src-web/components/core/Editor/twig/templateTags.ts +++ b/src-web/components/core/Editor/twig/templateTags.ts @@ -92,11 +92,12 @@ function templateTags( let option = options.find( (o) => o.name === name || (o.type === 'function' && o.aliases?.includes(name)), ); + if (option == null) { const from = node.from; // Cache here so the reference doesn't change option = { - invalid: true, type: 'variable', + invalid: true, name: inner, value: null, label: inner, @@ -112,7 +113,8 @@ function templateTags( for (const arg of option.args) { if (!('optional' in arg)) continue; if (!arg.optional && values[arg.name] == null) { - option.invalid = true; + // Clone so we don't mutate the original + option = { ...option, invalid: true }; break; } }