From 28686046c08f461c76316546b4ca8f8f206adf44 Mon Sep 17 00:00:00 2001 From: CarliPinell Date: Tue, 15 Jul 2025 09:22:15 -0400 Subject: [PATCH 1/2] Fixing mustache syntax variables with values with spaces --- src/components/renderer/form-record-list.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/renderer/form-record-list.vue b/src/components/renderer/form-record-list.vue index ac596f547..40e8773d7 100644 --- a/src/components/renderer/form-record-list.vue +++ b/src/components/renderer/form-record-list.vue @@ -627,7 +627,8 @@ export default { } // Add quotes around string values in PMQL if they don't have them - processedPmql = processedPmql.replace(/= ([^"'\s]+)/g, '= "$1"'); + // This regex now properly handles values with spaces by looking for the end of the comparison + processedPmql = processedPmql.replace(/= ([^"'\s][^"']*[^"'\s]|[^"'\s]+)(?=\s|$)/g, '= "$1"'); return processedPmql; } catch (error) { From 047e66ec1ff4928a5c884032ecf6870e4b67fbef Mon Sep 17 00:00:00 2001 From: CarliPinell Date: Thu, 17 Jul 2025 11:40:46 -0400 Subject: [PATCH 2/2] Solving issues with special characters --- src/components/renderer/form-record-list.vue | 21 ++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/components/renderer/form-record-list.vue b/src/components/renderer/form-record-list.vue index 40e8773d7..62423f8eb 100644 --- a/src/components/renderer/form-record-list.vue +++ b/src/components/renderer/form-record-list.vue @@ -469,9 +469,9 @@ export default { this.currentPage = this.currentPage == 0 ? 1 : this.currentPage; } }, - // Watch for changes in the option input field - "validationData.option": { - handler(newValue) { + // Watch for changes in validationData to handle any Mustache variable changes + validationData: { + handler(newValue, oldValue) { if (this.source?.sourceOptions === "Collection" && this.source?.collectionFields?.pmql) { this.onCollectionChange( this.source?.collectionFields?.collectionId, @@ -479,6 +479,7 @@ export default { ); } }, + deep: true, immediate: false } }, @@ -614,12 +615,9 @@ export default { // Get data from validationData const data = this.validationData || {}; - // Clean up the PMQL by removing unnecessary quotes around Mustache variables - let processedPmql = pmql.replace(/"{{([^}]+)}}"/g, "{{$1}}"); - - // Process Mustache variables - processedPmql = Mustache.render(processedPmql, data); - + // First, process all Mustache variables (both quoted and unquoted) + let processedPmql = Mustache.render(pmql, data); + // Check if the processed PMQL has empty values if (this.hasEmptyValues(processedPmql)) { this.collectionData = []; @@ -628,7 +626,10 @@ export default { // Add quotes around string values in PMQL if they don't have them // This regex now properly handles values with spaces by looking for the end of the comparison - processedPmql = processedPmql.replace(/= ([^"'\s][^"']*[^"'\s]|[^"'\s]+)(?=\s|$)/g, '= "$1"'); + processedPmql = processedPmql.replace( + /= ([^"'\s][^"']*[^"'\s]|[^"'\s]+)(?=\s|$)/g, + '= "$1"' + ); return processedPmql; } catch (error) {