SPA vs. multi page in terms of WU usage

In general terms, what are the pros and cons of using SPA vs. multi page in terms of the new pricing and WU? Which one should consume the fewer WUs in principle?

Thanks.

1 Like

I believe it will greatly depend on the app itself, however, SPA will generally consume much more WU.
This is because in some cases, Bubble fetch data from hidden groups, therefore performing searches, condition verifications and API calls.
Though this can be theoretically bypassed with big optimization work.

1 Like

hmm I did not know bubble does searches even for groups that are not visible.
I am building a dashboard app and using different pages for each dashboard tab is far from a good UX.
does using resuables limit the searches done in hidden groups (if those reusablse are hidden)?
thanks
@adamhholmes would appreciate your opinion on this, too

They do search if they are needed. For example, if the hidden group is referenced by another visible element OR if conditionnal need to fetch data

2 Likes

So, I have a page where I have a reusable. The reusable has a repeating group that is filtered using data from the URL. The reusable is initially hidden; the reusable is shown when the URL parameter tab=users. my question is:
when the page is initially loaded (and the reusable is invisible) will the search in the RG in the reusable be executed? Or will the search be executed only when the reusable is shown?

@ihsanzainal84 do you have an input on this topic?

thanks

As mentioned by @Jici the search will only happen if the hidden element is referenced. Any conditionals referencing a search will always load data regardless if the element is visible or not.

In your case since your condition for visibility is referencing a text parameter from the url, it shouldn’t trigger the hidden element’s data source.

1 Like

Thanks @ihsanzainal84. Can you provide an example of “conditionals referencing a search” in a reusable element? How can we refer to a RG in a reusable?

Thanks

Something like a “Search for:count >0 then make element visible” will require your app to load the count so that it can trigger when the condition is true. Which also counts as a WU since its realtime.

1 Like

Now I’m curious, let’s say someone views a page (when I say page I mean a reusable group like @sensei01 's SPA) and it has a search and some other data… now the user navigates away and views a different page.

That previous page is still loaded and I bet now it’s listening for database changes. I’m pretty sure WUs are used for realtime database updates? I don’t see why not

I would image we would then need to do a bunch of conditionals that if it isn’t visible, you do :make static inside the reusable element’s data sources or something. That sounds like an absolute nightmare though

Unless I’m wrong and hidden groups don’t get updated database changes until they are shown again? I might ask support if no one knows.

1 Like

If you check out the WU optimization live stream in Andrew’s (i think his name is Andrew) ShootAssist app demo, he talked about realtime search in hidden elements a little bit.

It’s okay in bits and pieces but having it run in multiples, which is common in RGs, can rack up WUs.

I’ve come to realize that it’s insane to get worked up about figuring out how much WU individual actions cost. I just focus on what workflow is consuming the most WU and spot reducing any parts of it. Sometimes just reworking how things work.

1 Like

Any new insights on this topic? I think there is still a lot that need to be figured out regarding WU usage and data fetching in SPA’s.

I’m quite struggling with this challenge at the moment as well and I’m hoping for best practices real quick. I’m actually expecting tips, new features and knowledge sharing from the Bubble team, but I’m afraid there is no incentive for them to make this a high priority.

I am hoping :pray: that Bubble has all engineers hard at work putting together new features to help with data fetching. It is one of the most important things in my mind at the moment. I’m sure once they put some together they will have tutorials on them, but likely not a lot of tips as those typically come from people who actually use Bubble, not the people who made it.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.