{suggestions.map((suggestion) => (
diff --git a/apps/client/src/features/app-settings/panel/automations-panel/template-input/__tests__/templateInput.utils.test.ts b/apps/client/src/features/app-settings/panel/automations-panel/template-input/__tests__/templateInput.utils.test.ts
index 298e818b0..3af67c7cd 100644
--- a/apps/client/src/features/app-settings/panel/automations-panel/template-input/__tests__/templateInput.utils.test.ts
+++ b/apps/client/src/features/app-settings/panel/automations-panel/template-input/__tests__/templateInput.utils.test.ts
@@ -6,10 +6,8 @@ describe('matchRemaining()', () => {
expect(matchRemaining('{{{hum', '{{human}}')).toBe('an}}');
expect(matchRemaining('send {', '{{human}}')).toBe('{human}}');
- // we should be able to match the following
- // however, the current implementation only needs to deal with strings that start with {{
- // expect(matchRemaining('{', '{{human}}')).toBe('{human}}');
- // expect(matchRemaining('{{', '{{human}}')).toBe('human}}');
+ expect(matchRemaining('{', '{{human}}')).toBe('{human}}');
+ expect(matchRemaining('{{', '{{human}}')).toBe('human}}');
});
it('should return an empty string if there are no matches or if it is complete', () => {
diff --git a/apps/client/src/features/app-settings/panel/automations-panel/template-input/templateInput.utils.ts b/apps/client/src/features/app-settings/panel/automations-panel/template-input/templateInput.utils.ts
index 7379d24b8..d911709f7 100644
--- a/apps/client/src/features/app-settings/panel/automations-panel/template-input/templateInput.utils.ts
+++ b/apps/client/src/features/app-settings/panel/automations-panel/template-input/templateInput.utils.ts
@@ -83,6 +83,16 @@ export function matchRemaining(a: string, b: string) {
return '';
}
+ // naive match assuming that a template will start with {{
+ if (a.endsWith('{{') && b.startsWith('{{')) {
+ return b.substring(2);
+ }
+
+ // naive match assuming that a template will start with {
+ if (a.endsWith('{') && b.startsWith('{{')) {
+ return b.substring(1);
+ }
+
for (let i = 0; i < b.length; i++) {
const searchString = b.substring(0, i + 1);
if (a.endsWith(searchString)) {