Forum Academy Marketplace Showcase Pricing Features

Very long delay in making an element not visible [BUG]

Hey everyone,

I am experiencing a really nasty bug when making my plugin element “not visible”. I’ve got my plugin element that has its visibility based on a state (when the state is “yes” it is visible). When a button is clicked, the state becomes “no” and so the element knows not to be visible. (Bubble uses the css property “visibility” which is a pseudo-transitionable element, so I believe this is the root of the issue).

I am experiencing a huge bug where when the state is no it sometimes takes up to 2 seconds for it to become invisible. You might say, hey, just check for the bubble.is_visible() property and run some code based off of that. Well …

THE BIG PROBLEM: When the visibility property changes, the update function does not run …

Let me repeat that: when the visibility property goes from yes to no, or no to yes, the update function does not run :confused:

Therefore, there is no straightforward way for a bubble developer to run any code based on the visibility property. This is a huge problem for me and I assume for many plugin devs.

Does anyone know of any workaround?

Just add your own event handler to the page and trigger/respond to that event. I recently started to think this approach should be used by all plugin builders, relying only on Bubble provided functionality only as needed.

2 Likes

I had to use a Mutation Observer :man_facepalming:

Thanks for the tip @bubble.trouble

For anyone who faces this issue, please use the following method to be able to tell when the visibility property changes on a given element. Run it inside your initialize function.

2 Likes