mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-23 17:18:32 +02:00
Fix better
This commit is contained in:
@@ -190,7 +190,7 @@ function InitializedTemplateFunctionDialog({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="px-6 border-t border-t-border py-3 bg-surface-highlight w-full flex flex-col gap-4">
|
<div className="px-6 border-t border-t-border pt-3 pb-6 bg-surface-highlight w-full flex flex-col gap-4">
|
||||||
{previewType !== 'none' ? (
|
{previewType !== 'none' ? (
|
||||||
<div className="w-full grid grid-cols-1 grid-rows-[auto_auto]">
|
<div className="w-full grid grid-cols-1 grid-rows-[auto_auto]">
|
||||||
<HStack space={0.5}>
|
<HStack space={0.5}>
|
||||||
|
|||||||
@@ -92,11 +92,12 @@ function templateTags(
|
|||||||
let option = options.find(
|
let option = options.find(
|
||||||
(o) => o.name === name || (o.type === 'function' && o.aliases?.includes(name)),
|
(o) => o.name === name || (o.type === 'function' && o.aliases?.includes(name)),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (option == null) {
|
if (option == null) {
|
||||||
const from = node.from; // Cache here so the reference doesn't change
|
const from = node.from; // Cache here so the reference doesn't change
|
||||||
option = {
|
option = {
|
||||||
invalid: true,
|
|
||||||
type: 'variable',
|
type: 'variable',
|
||||||
|
invalid: true,
|
||||||
name: inner,
|
name: inner,
|
||||||
value: null,
|
value: null,
|
||||||
label: inner,
|
label: inner,
|
||||||
@@ -112,7 +113,8 @@ function templateTags(
|
|||||||
for (const arg of option.args) {
|
for (const arg of option.args) {
|
||||||
if (!('optional' in arg)) continue;
|
if (!('optional' in arg)) continue;
|
||||||
if (!arg.optional && values[arg.name] == null) {
|
if (!arg.optional && values[arg.name] == null) {
|
||||||
option.invalid = true;
|
// Clone so we don't mutate the original
|
||||||
|
option = { ...option, invalid: true };
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user