Hello, amazing Bubble community!
Ever wondered how to manage empty states in your Bubble app efficiently without consuming a single Workflow Unit? Our latest article dives deep into this crucial aspect of app development.
Why It Matters:
Efficient empty state management enhances user experience and app performance. Learn how to implement this crucial feature seamlessly.
Curious? Read the full guide here.
If you prefer video format, check this video guide.
Option 1: Checking â:count is 0â
Probably the most popular approach is to check if â:count is 0â for the list items inside the repeating group, and display an empty state if this condition is true.
However, this option is the least efficient and consumes the most WU (3.8 WUs per 1000 items in the list, as per AirDev report here. Itâs caused by a bug in Bubble code, that leads to consuming so many WUs.
Note: if you change the condition to â:count < 1â â it will consume only 0.2 WUs per 1000 items.
Option 2: Checking â:first item is emptyâ
Probably 2nd most common approach is to check â:first item is emptyâ. Meaning if the first item is not there â then the list has no items at all.
This approach consumes 0.69 WUs per 1000 items. Itâs better than â:count is 0â, but worse than â:count < 1â.
Weâd like ideally to not consume any WUs at all.
Option 3: Place the âEmpty viewâ behind the Repeating Group
We can design our layout in a way that we wonât need to add any conditions at all. For example, we can group our Empty State and Repeating Group inside a âAlignt to parentâ container and put the Empty view behind the Repeating Group.
Check âBehindâ tab in the application.
Such an approach wonât consume any WUs (cos we donât have any conditions at all).
However, it will work ONLY in the following cases:
- When the list item doesnât have a transparent background (cos otherwise empty view will be visible behind).
- When the height of the first list item is bigger than the height of the empty view.
In other cases, the Empty view behind will be visible or partly visible. Plus, there might be a small blink during the first load (when the list items are not loaded yet).
Option 4: Place the âEmpty viewâ behind and add frontend-only conditions
We can improve our previous cases by adding some conditions that will allow us to have any kind of empty views behind, regardless of the size or background of the list item.
For it, weâll need to make our Repeating Group âFit height to contentâ (in the âLayoutâ tab). And the following conditions:
- Page loaded above fold (it waits for the initial page to load)
- RG: is loading is no (it waits for the RG to finish loading)
- RGâs height < 10 (it checks the height of the RG. If no item â its height will be zero (or a very small number).
If these conditions pass, you now have full control over your empty state, donât consume any WUs, and provide your users with a snappier experience (since your app makes fewer requests).
This approach can have a meaningful effect if you have many rows in your database or many repeating groups on the page.
In any case, measure and check what works best for your app and use the approach that suits you best.
Conclusion
Bubble is a powerful no-code platform. However, by not following its best practices and not understanding how it works, you can easily overload your Bubble app with redundant requests. Follow these best practices to improve your appsâ performance, and speed, and save costs on less WU consumption.
Hope it helps .
Links to explore:
The Demo Bubble app link (username / password: âtestâ / âtestâ)
For an enhanced upgrade to your Bubble app, explore our Natively no-code development tool, which effortlessly converts Bubble apps into Android and iOS versions, ready for quick publishing on app stores.
Feel free to drop your thoughts, questions, or share your experiences with optimizing empty states in your Bubble apps. Letâs spark a conversation!
Explore, Implement, and Elevate Your Bubble App Development!
Happy Bubbling!