Skip to content

Commit

Permalink
fix(dashboard): Treat inline payload variables as not required
Browse files Browse the repository at this point in the history
  • Loading branch information
SokratisVidros committed Dec 23, 2024
1 parent 21e2191 commit 26cdff6
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const Maily = (props: MailyProps) => {
variables={({ query, editor, from }) => {
const queryWithoutSuffix = query.replace(/}+$/, '');

const autoAddVariable = () => {
function addInlineVariable() {
if (!query.endsWith('}}')) {
return;
}
Expand All @@ -98,9 +98,15 @@ export const Maily = (props: MailyProps) => {
editor?.commands.deleteRange({ from, to });
editor?.commands.insertContent({
type: 'variable',
attrs: { id: queryWithoutSuffix, label: null, fallback: null, showIfKey: null },
attrs: {
id: queryWithoutSuffix,
label: null,
fallback: null,
showIfKey: null,
required: false,
},
});
};
}

const filteredVariables: { name: string; required: boolean }[] = [];

Expand All @@ -110,7 +116,7 @@ export const Maily = (props: MailyProps) => {
filteredVariables.push({ name: queryWithoutSuffix, required: false });
}

autoAddVariable();
addInlineVariable();
return dedupAndSortVariables(filteredVariables, queryWithoutSuffix);
}

Expand All @@ -123,7 +129,7 @@ export const Maily = (props: MailyProps) => {
filteredVariables.push({ name: queryWithoutSuffix, required: false });
}

autoAddVariable();
addInlineVariable();
return dedupAndSortVariables(filteredVariables, queryWithoutSuffix);
}}
contentJson={field.value ? JSON.parse(field.value) : undefined}
Expand Down

0 comments on commit 26cdff6

Please sign in to comment.