Let us build expression functions in a plugin

In my mind, the greatest failure of the plugin system is the inability to run a function client side and return data to ANYTHING other than an element on the page. (Ya ya, server side actions. Got it. No one can wait 3 seconds to receive a response in real life)

Truthfully, even returning data to an element is unworkable for a lot of scenarios since it can’t be returned INSIDE AN EVENT. There is literally no execution context.

Nope, it’s just a random state that gets set on the element and hopefully we can catch the correct state when the event is triggered but, boy oh boy, the same action ran a split second later with different data so now there is a different value in that state and our database is screwed up.

Why? Why? This one baffles me. Why not let us return a value inside an event? We could do SO MUCH with that.

But you know what would be even better?!!! Let us create expression functions!

I see this as two options.

#1, when there is no value in the expression, add a Get data from a plugin function just like the Get data from an external API.

What could we do with this?

  • Retrieve data from local storage
  • Process JSON on the fly inside our text
  • Run mathjs in the browser and the beautiful complex calculations that come with it.
  • Return lists of dates, numbers, texts, json, etc
  • Create a repeating group with an array of JSON values and display field values as easily as we can with a custom data type
  • Client side API calls
  • Just about anything…

#2, when there is a value in the expression, add a Run plugin function operator.

What could we do with this? Let’s see…

  • Build our own conditional logic for values to display without having to chain a bunch of format as text or user conditionals where we have to maintain the same text across multiple conditions with a single value changed
  • Location specific currency formatting
  • Location specific date formatting
  • Location specific numeric formatting
  • Default formatting for all of the above
  • Iterators
  • Aggregators
  • Custom conditional logic
  • Any and all types of data manipulation

The possibilities are literally endless.

Honestly, there is nothing Bubble could build that would be more impactful for the Bubble ecosystem than this.

Why? The army of plugin developers would build all the small shit Bubble doesn’t want to build.

Bubble doesn’t want to bother with local storage because only a few ask about it? We’ll build it.
Bubble doesn’t want to bother with JSON manipulation and extraction? We’ll build it

The truth is we are already building this stuff but with inadequate tooling. Returning data to an element and then triggering an event is not enough.

We are out here, ready to build but WE NEED THESE TOOLS!

And I’m not talking about the ability to run some generic Javascript code. I’m talking about a true function with execution context where you put data into it and data is returned relevant to what was put in.

I’ve even built the mockups for you below.

23 Likes

Hope Bubble team listens to this