A guide to advanced use of reusables

How to display several parameters into popup, not from the RG

Hey, can anybody help with this?

Iā€™ve heard that reusable elements can help me.

Great post @petter ! Thanks very much for this! Fell into this thread after reading your post about performance (bought the book btw, hope Iā€™ll learn a lot from it!)
I feel like reusable elements behave the same way as reusable/child components if you are from a front dev background e.g. in vuejs

Was just wondering if this editor-performance issue was still a subject of matter now (as it is 18 months from the post) and if yes what is now the best and free approach (the ones listed in your post) ? the best and paid approach/plugin?

I am using reusable elements in a single web app, and I use actions WHEN PAGE LOADS for each reusable element.

But the REUSABLE PAGE LOAD gets triggered multiple times and I have no idea why. I want to execute only ONCE the page load.

have you noticed this? how to avoid it? I want to improve performance

@nassmim972
The editor performance is still definitely an issue, unfortunately. Whether this will change with the new editor update I donā€™t know, unfortunately.

@natserrano
Iā€™m not exactly sure what your setup looks like, but if you have multiple reusables on the same page, then the page load workflow will trigger for each one of them. Theyā€™ll also trigger whenever you use the Go to page action, even if you donā€™t leave the page (by changing some URL parameters for example)

2 Likes

@petter Great post! I had a couple of frustrations with Env Variables. The big one is it doesnā€™t work for lists. It also doesnā€™t have a clean way to raise an event (e.g. pick up on the main page if a button is clicked in the reusable element). Iā€™ve written a new plugin to address these issue, which you can find here: https://shared-state.bubbleapps.io/. The basic concept is very similar to Env Variables. Let me know what you think!

Hi @petter and thanks a lot for the guide. Super helpful!

Can you do an example of the above, please? So I can understand it better.

Hi John, im exactly trying to do this with a Reusable focusing group, but I been trying for hours, but I really donā€™t know how to set the var with the Browser storage.

Do you have any tip?

Thanks in advance

Hello @daniel_zamora27

Ask ZeroQode for support on their website. https://forum.zeroqode.com

Hi Petter, thanks a lot for this detailed explanation. Very useful!
Iā€™m considering moving my app to this reusable elements structure because itā€™s becoming really heavy and slow.
But Iā€™m foreseeing a lot of work ahead so I would like to make sure I understood it right:

  1. transform the groups in reusable elements (each reusable element is a ā€œpageā€)
  2. place all the reusable elements on the index page piling them up (before it used to be groups) and making them not visible by default.
  3. call the reusable element through a user action with a custom state.

An additional question: how did you deal with the different page heights ?
For my current single page app with different groups, Iā€™m using a transparent ā€œhidingā€ group that collapses and uncollapses.
Thanks in advance

Best
Lucia

Put the reusable element inside a group and use the same conditions you were using before to hide-collapse the groups. Put them one after the other and not on top of each other.

Thanks @sharma.himanshu0608! So you mean vertically one after the other?

Yup. Thatā€™s recommended for avoiding responsiveness issues.

ok thanks. And having such a long page have no impact on the page load speed or anything else?

Single page apps are a bit slow to load initially but the experience is better once loaded. On the other hand, multiple page apps are fast to load but the navigation between the pages will be slow.

So youā€™ll need to check which method works best for you.

Thanks a lot @sharma.himanshu0608 . Will think about the best fit for my case.

1 Like

Hi @eli, curious - why is it more efficient to store current and past page states vs getting it from the URL?

Does it speed things up?

Great guide @petter and a nice addendum to your Bubble performance ebook The Ultimate Guide to Bubble Performance - the new edition is out (now 210 pages!)

One question Iā€™ve been wondering about ā€“ whether reusables do or donā€™t reduce the # of elements on a page, and in turn impact performance. Say for example I have 5 groups on a page and each group is the same. I could convert these 5 identical groups into 1 reusable element that I place on my page 5 times. Does Bubble now just load 1 group (which should result in a performance improvement), or does it load the reusable 5 group times (implying no performance improvement).

Hey Ed!

Reusable elements from my understanding do affect the size of the Bubble code base, but from the way HTML is rendered I doubt it will affect the number of elements much. That part is handled by the browser, so thereā€™s not much Bubble can do to change it.

Bubbleā€™s engine is a bit of a mystery box here, so itā€™s hard to say just how much thereā€™s to gain from it. But assumedly youā€™ll avoid multiplying workflows, conditions etc in the code, keeping it lighter.

I would think about reusables mostly from the perspective of development: 1) to avoid slowing down the editor and 2) to speed up development and maintenance.

Performance is worth keeping in mind, but I wouldnā€™t expect a huge impact.

1 Like

Thanks @petter as always for the solid advice!

1 Like