From 7343e53659e9020024653914157ed707a0c07f89 Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Thu, 3 Jul 2025 19:39:36 +0530 Subject: [PATCH] fix: Variable search item not showing after braces/commas (#11864) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Pull Request Template ## Description This PR fixes an issue where typing variables, like `{{contact.name}}`, caused the variable list to miss showing `contact.name`. The search key in this case became `contact.name}},` which didn't match any available options. The logic in `VariableList.vue` only checked the part after the last comma and didn’t fully sanitize the input. **Solution** Updated `searchKey` to remove all {} and commas for accurate matching. Fixes [CW-4574](https://linear.app/chatwoot/issue/CW-4574/i-dont-see-an-option-for-contactname-it-shows-initially-but-it-doesnt) ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) ## How Has This Been Tested? ### Loom video https://www.loom.com/share/fc86e53853ad49e6acf6de57ebbd8fcb?sid=6702f896-d1a3-4c5a-9eb7-b96b5ed91531 ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules --- .../widgets/conversation/VariableList.vue | 8 +++-- app/javascript/dashboard/helper/commons.js | 13 +++++++ .../dashboard/helper/specs/commons.spec.js | 35 +++++++++++++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) diff --git a/app/javascript/dashboard/components/widgets/conversation/VariableList.vue b/app/javascript/dashboard/components/widgets/conversation/VariableList.vue index 1b935ad29..30e45749b 100644 --- a/app/javascript/dashboard/components/widgets/conversation/VariableList.vue +++ b/app/javascript/dashboard/components/widgets/conversation/VariableList.vue @@ -1,6 +1,7 @@