In this support article, we will discuss how to reduce the number of requests your Bubble.io app generates for improved performance, faster loading times, and reduced consumption of Workflow Units (WUs). We will explain the significance of requests and provide examples of how to query data efficiently.
Understanding Requests in Bubble.io
Every time a user visits your Bubble.io app, the browser generates requests to load content such as HTML, stylesheets, and JavaScript files. These requests also include those made to send or receive data from the Bubble backend. Generally, a Bubble.io app performs two initial requests upon loading a page, followed by additional requests depending on user interactions.
Estimating Requests Per View
On average, multi-page apps make 5 requests per view, while single-page apps make 2 requests per view. Apps with inefficient setups or complex interactions, such as multiple searches, workflows, or API calls, may generate even more requests per view.
Strategies for Reducing Requests in Your Bubble.io App
Efficient Data Querying
Instead of performing multiple searches, consolidate similar queries to reduce the number of requests. For example, use a single state on the page to hold all "To-Do" items and filter the results within repeating groups, rather than performing separate searches for new, in-progress, and finished tasks.
Consolidating External API Calls
When obtaining data from multiple external APIs, consider creating a backend API that fetches all required data in a single request, rather than sending multiple requests for each API.
Using Single-Page Apps
Single-page apps usually generate fewer requests than multi-page apps, as they only load data from Bubble once for each page visit, thus reducing the number of requests.
Conclusion
Reducing the number of requests in your Bubble.io app will not only improve its overall performance but will also lower the consumption of Workflow Units (WUs). By implementing efficient data queries, consolidating API calls, and opting for single-page apps, you can create a more responsive and cost-effective app experience for your users.