Nested Repeating group with one search querry

Hello,
I’m building my first Bubble app and it goes well so far.
I come here for advices on perf topic.
(the below is a simplified version of my use case, illustrating the objective I try to reach)

In the app, I have an events section where people can list up to 40 events. Each of them including 2 to 10 participants.

I would like to structure the page like this:

  • RepeatingGroup Events, including:
    • Event name
    • Other event details such as date, place etc.
    • RepeatingGroup Participants, including:
      • Participant avatar
      • Participant name and other participant informations

I have a Subscription table that contains

  • subscriptionDate (Date)
  • subscriptionRate (Number)
  • participant (Participant)
  • event (Event)

For performance reason, I would like to do this in a single search on the Subscription table, with no result so far. I investigated a :groupby event but I did not find a way to loop inside each Grouped:event for each RepeatingGroup Participants

I manage to do a Search on Events for the RepeatingGroup Events. Then, for each row, I can do a new search on Subscription with event=Event as a constraint.
This would give me my nested repeating group but it might create up to 41 queries (one for the list of events and then one per event).

I have 3 questions for the Bubble community:

  1. Did I miss a way to have nested repeating groups with one single query?
  2. If no, on the performance side,
    • is it better to have one Search for… with a different constrain for each RepeatingGroup Events row OR
    • Is it better to repeat the same Search for… but apply a different :filter per RepeatingGroup Events row (assuming that the :filter might be executed front end with no impact on performance or additional WU)
  3. Is there any better way to reach my goal ?

Thanks in advance for your help
Johann

FYI, as I was not sure what the impact would be nor how to force Bubble to do the filtering on the front-end, this is how I did it:

I performed 2 “Search for” actions:

  1. One with a “group by” and used it in my RG.
  2. The other one I placed as a List in a custom state.

Then, inside my RG, I perform a “Search for” with the custom state as the source, on which I apply a “:filter” based on my RG item.

This way, I’m sure that I only have 2 search queries used back-end.

I would appreciate it if an experienced Bubbler could validate this approach or suggest anything better. Thanks!

Hmm…what do you mean by: “Search for” with the custom state as the source?

When I store any list in a state to be use as a source for additional filtering I would use the :filtered operator like so
image

Hello,
Sorry, you’re right, there’s no “Search for”.
I wrote what I did last Friday without looking at the actual code.
So the data source is similar to what you copied.
Capture d’écran 2024-05-06 à 13.36.45

Was this the best way to handle it ?
Johann

Yep. That’s the best way to load data from my experience and reading. Storing into states prevents unnecessary searches.

Do note that individual “Things” in the state still get updated in realtime. So each time one is updated, it comes with a, negligible IMO, WU cost.

The WU cost does stack if large lists of loaded data gets updated very frequently in the time your user has the data loaded.

Just plan ahead, anticipate how the data is used by your users and backend systems, and you pretty much have full control over your WU costs.

1 Like