I’m going to go against the grain here:
SPAs can be good, but also they can be very problematic. I would caution anyone to think about this approach seriously before investing a significant amount of time–especially if the page will be large/complex with lots of elements. I say this from hard-fought experience trying to deal with serious issues with my own large SPA.
SPAs do have their place and are useful for things like small/medium sized dashboards to help minimize server/db requests and improve load times and user experience. HOWEVER, for larger and more complex pages with lots of different elements, conditionals, etc SPAs can be a challenge–dare I say a ‘nightmare’–to work with in bubble. Backtracking and undoing this approach after you’ve gone down that road is an equal nightmare.
If you are going to build an SPA, employ the KISS principle.
In my own case, I did not use KISS. I built a very polished (see: bloated and convoluted) page template with lots of elements and conditionals and states. I then copy/pasted my template elements for all of my necessary ‘sub pages’. At the time, I was full-throated SPA-guy and my guiding philosophy was that our user would deal the longer page load time of my large SPA because of the benefits I mentioned above.
What I didn’t count on were the performance issues editing this page inside the bubble editor and the performance of the page itself after loaded.
tl;dr I’m currently going through the process of splitting up my SPA into individual pages and its a bitter divorce.
Basically my large SPA choked the bubble editor performance so much as to basically become impossible to work with effectively. I didn’t come to this decision lightly (or quickly) because of the effort involved to do this. I first scanned the forums first looking for any answer to help speed up performance like turning off the issue checker using issues_off=true
, refreshing the browser every 20 minutes, etc, faster development hardware (I have a late-model i7) .
Even with all of the above maxed out, I had persistent performance lags. I would constantly wait in anticipation after clicking elements and expressions wondering ‘did it register my click?, I don’t want to click again if it did’. Running live previews took 20-30 seconds to load. Its no wonder though, after pulling a chrome page load audit my downloaded page data weighed in at over 20MB! this is downloaded every.single.time. Yikes.
I’ve seen an increased mention lately to use ‘reusable elements’ to help break up the complexity of these larger SPAs and help boost editor performance. While this does help editor performance, it does not speed up page load time. Reusable elements are downloaded, in full with your page/ . Even if you don’t care that it will take your user longer to load the page, remember that you need to load the page all the time while developing. This can sting when trying to iterate through changes. Additionally, running your large page takes away from overall performance and this impacts the editor too.
For larger designs with lots of element, I’d recommend the more traditional approach of making individual pages with reusable elements for top navigation, sidebar, and footer.