[Upgrade to Bubble Version 21] Improved Runtime Performance

@dorilama while it’s a bit confusing what the relationship is between the color picker bugfix (I guess more accurately – an enhancement to allow support for color variables being used in color pickers in plugins) that went out across all versions today and Bubble Version 21, the thing that caused certain plugins to break was the former (not Bubble Version 21 specifically).

And it was a real bonehead error. Whatever that bugfix version of the color picker was doing, it didn’t accommodate the case of the picker being empty and returning null. So Bubble’s code was trying to do some hex/rgba conversion on null and crashing. Hey, we’ve all been there, amirite?

3 Likes

Hey @nick.carroll

We understand that the divs will not be available till they are rendered or visible.

The issue that I am always faced with is looking for the div that matches the ID. If the div is not available on the page then I attach some kind of observer so when it does appear I can execute the code

So here’s a question! Why doesn’t bubble provide this as native functionality in the plugin editor. It would be much easier for everyone if bubble had some sort of method or function that we can call on that would execute the plug-in code when the element appears

Since I bought this up can we also have a look at these

  • have bubble load script tags for us
  • utilizing open source scripts that bubble already uses

I can go on forever but I guess these are the most important things

5 Likes

@AliFarahat probably because there’s no real way to know that your plugin is waiting on such-and-such an element (consider that in your plugin interface, that field’s just going to be some random text field that accepts a string that represents the unique ID of the element you’re waiting for). There’d have to be some special input field to make this connection. (Which is not to say there couldn’t be one, but I wouldn’t hold my breath for something that tweaky. I think there are bigger questions of a similar nature, like “why is there not a canonical “getList” function?” )

You develop more visual plugins than I, so I’ve only run into this issue once out of umpteen plugins, but as you suggest, I handled it like so:

instance.data.funcWaitForElement = function waitForElement(selector) {
        return new Promise(resolve => {
            if (document.querySelector(selector)) {
                return resolve(document.querySelector(selector));
            }
            const observer = new MutationObserver(mutations => {
                if (document.querySelector(selector)) {
                    resolve(document.querySelector(selector))
                    observer.disconnect();
                }
            })
            observer.observe(document.body, {
                childList: true,
                subtree: true
            })
        })
    }

And then used in some other function like:

instance.data.funcWaitForElement(instance.data.drag_rg).then((elm) => {
        // do something that requires this element to exist
})
5 Likes

@AliFarahat, you’re not asking about situations like this, are you?

This is what initialize is for. You could instead just do:

As the docs state, initialize is executed just once when your plugin element gets instantiated in the page.

Edit: To be very clear: Your plugin element doesn’t have to wait for itself, because initialize. (But you may need to wait for some other element, in which case you’d take the approach I outlined in my previous reply.)

Edit 2: Also, you can load your scripts in a non-render-blocking way using defer. There are some things that the plugin API gets right and one of them is that initialize will only run after the dependencies you’ve defined in the header are loaded, so there’s no problems there and nothing you need to worry about except perhaps competing versions of the same dependency amongst similar plugins.

Once dependencies are loaded, initialize will run once for [this instance of] the plugin and then, immediately thereafter the update function will run for the first time (which is our first access to properties that the user might have provided in the element’s main property inspector), so the end of that routine is our opportunity to set things like an “Initialized” internal state and corresponding external “exposed state” and in that way we can tell the user that our plugin is either done with its stuff, or ready to accept Actions in the case of plugins that actually do stuff.

1 Like

@vnihoul77 Any idea how this affects performance for pre-fetching?

I’m assuming this update is supposed to increase the performance of non-prefetched apps, but I wonder if there’s any impact on prefetched apps.

2 Likes

Im sure a silly question, but can one downgrade a version by restoring a previous save point? Ie, I can test an app in v21 (not live) and then simply revert to an earlier save point if too many things are funky?

@drfalken I don’t know if reverting to a previous time would revert the version, but they let you rollback to the previous version you were on.

right, I guess that’s the question if it also rolls back the ‘bubble engine’ version

@keith I understand the cause of the issue and is perfectly clear.

What I propose is bubble alerting any account that creates plugins that a change is about to be published in x time, and the ability to apply that change on the test app of plugins.
In this way we can have a window of time where we can test the change without affecting production apps.
This could be a system similar to the experimental features: you go on your test app and enable “future plugin system update”, and then test if your plugin works.

My plugins (all private) were not affected by this change, but I would like to be notified when bubble is planning a change in the plugin system so I can check that everything is fine.

3 Likes

Also I think an alert should go out to the people using affected plugins (if there is a way to determine affected plugins). Otherwise if plugin developer fails to respond in time, all the people who have installed plugin get impacted without them even realising about it.

3 Likes

Hey @nick.carroll

Will the hidden inputs that made calculations still work with this update?

For example, we have a bunch of hidden inputs that calculate prices, sum of things, etc. Will them still work?

Thanks a lot.

1 Like

Thanks @nick.carroll , It is working fine now.

Hey!

So, I was wondering if this also maybe changed how internal page changes to the same page were handled? Before, when I redirected to the same page with different page parameters / paths, it didn’t actually “Refresh” the page. It seems as if that is no longer the case, as now as I browse my site, it seems to fully refresh, and my audio player resets. Luckily autoplay kicks in and will throw it back on, but there is a 4ish second gap.

I haven’t even updated to this new version yet, but this issue has just recently popped up.

We did also move where the Media player is stored to a reusable, so I’m wondering if that could also be the cause. I don’t know.

Adding onto this, it seems the issue may be on my audio player. I just did some testing, and it seems the visuals think the audio player is still playing, eliminating the idea that the header is actually refreshing. So ignore this entire post, I need to find a new audio player.

I have quite a few hidden inputs doing calculations across my app and they all still function correctly, and I’ve been on the experimental build since it was available, so in theory yours’s should be fine too.

2 Likes

Hey @bcart0v

Thanks a lot for the info.

I was using the experimental feature before the new release, so I had already solved any issues caused by the new performance features before the release. Haven’t had any issues with upgrading.

I did have an issue caused by the color field bug, but that is now resolved.

This is yet another example that underlines the desperate need for more proactive communication from Bubble outside the forum.

I have exactly 0 emails from Bubble about this release, the updates to the color fields, or anything else that they’ve done in the past that caused breaking changes. (The timezone override feature is still a particularly fresh wound).

I’ve suggested before that Bubble needs to also release a Bubble Admin mobile app, with uptime and usage monitoring, as well as push notifications for updates, releases, max capacity events, etc. Probably never going to happen, but it would be helpful.

It really is simply shocking that they are only making breaking change announcements in this forum. That may have worked when Bubble was just a small startup, but that’s not the case anymore. There needs to be multi-channel outgoing communication about changes like this.

8 Likes

Yes, hidden inputs that are there just to do calculations will not be impacted.

2 Likes

Thanks for the confirmation @nick.carroll

This is a great idea. like a reverse 911

Just wanted to follow up on this – is the bubble version number able to be reversed?