Budibase / budibase

Low code platform for building business apps and workflows in minutes. Supports PostgreSQL, MySQL, MariaDB, MSSQL, MongoDB, Rest API, Docker, K8s, and more 🚀
https://budibase.com
Other
21.9k stars 1.51k forks source link

Replace multiple spaces in bindings with one space #14018

Closed PClmnt closed 3 months ago

PClmnt commented 3 months ago

Description

Fixes an issue where helpers and bindings weren't being parsed if additional spaces were added. This PR adds a processor that looks for multiple spaces and replaces them with one.

I did some benchmarking between the regex approach - statement.replace(/\s{2,}(?=(?:[^'"]*['"][^'"]*['"])*[^'"]*$)/g, " ") and the current approach and the character approach seems much faster.

Benchmark: https://jsbench.me/3hlxyiknts/1

Addresses

https://linear.app/budibase/issue/BUDI-8385/helper-functions-and-bindings-selected-from-the-popover-menu-add-an

linear[bot] commented 3 months ago

BUDI-8385 Helper functions and bindings selected from the popover menu add an additional space, breaks the bindings