∅ Dealing with empty string in Javascript being "falsey"

As a follow up to @keith’s discussion on how bubble deals with boolean values. I had a thought that may allow “dealing” with a particular issue with empty strings being falsey in javascript.

Following is the scenario I am having and a solution I propose:

Let’s say you have an input field called keyword search and a user can type in keywords that would show in a RG things that match this keyword. With that said, you also want everything in the repeating group to show if the user hasn’t typed anything.

The data source for the RG would then be Search for thing with the constraint any field contains keyword search's value. This would work when the user actually types in keywords, however, it won’t show anything if the user hasn’t typed anything in the input.

One solution would be to use bubble’s ignore empty constraints, which works for this simple case, but if you have other constraints you might not want to ignore them when they evaluate to empty (which you can find out more about what constitutes an empty condition by reading @keith’s discussion)

Here is what I found that worked for me and I wonder what do you think about this solution:

Do not click ignore empty constraints and instead change the constraint any field contains keyword search's value to any field contains keyword search's value is empty:formatted as text

Screen Shot 2020-10-25 at 9.43.51 AM

in :formatted as text add a condition for yes and for no like so:

Screen Shot 2020-10-25 at 9.32.27 AM

Now you will also need to add a field for every Thing object called placeholder with a default value ‘placeholder’.

When the user types keywords the input’s value would evaluate to not empty and the repeating group would populate with things that match the input. When the user has nothing typed there, there would actually be a string for which bubble would look for matching values and since you’ve added a placeholder field to all your Things it would find all of them.

I just want to add, that you can of course use a conditional even before you search for thing such as here:

But this may not work for every situation. Nor will my solution, but I just wonder what does the community here think of it. Thank you for reading this far.