Having to request Bubble support to look into some charges for WUs and fetching data as well as referencing data from an RG.
I have an RG, it is set to have a fixed number of Rows. So, only 4 items from the search are displayed, however, the entire ‘list of things’ count is already available in the RG as can be seen in the debugger.
When I asked support why I was charged 0.20 WUs for the text element reference to the RG list of things count, the explanation received was below
If your repeating group is only showing a portion of the results of a “Do a search” operation, our system only fetches the portion that is displayed. For example, when you have a repeating group that is showing 4 items, and the database has more than 4 items for that specific search query, our system only fetches the 4 items, and therefore does not have access to the total count of the results of the search. The reason why a list of things will incur 0.20 additional units when you access the :count is because the request to “count all the results” and “show the first 4 items” are considered separate requests in our system. So, we have to do an additional aggregate search to get the complete count.
Please note that if your repeating group is showing all of the items for the specific search query, referencing the count will not query additional WU.
In the simple setup, there is an RG, fixed rows of 4, and a text element, with reference to RG list of things count
Although the support agents reply can sound logical, it doesn’t make actual sense when we can see Bubble already has the count (as can be seen in the screen shot from the debugger)…so WHY, would the system, that already has the count and exposes the count on the RG element, consider the dynamic expression referencing the RG list of things count as a separate request?
It’s only when you open the debugger that the count request is run. It’s not loaded when the data is retrieved. When you search for items 1-4 in a larger list, you cannot tell how many items are left - all that Bubble returns is a boolean saying ‘is this the end of the list’.
When you open the debugger, a new aggregate search is run to get the list in the RG. You’ll see that if you load the page, turn off your internet, then open the RG in the debugger, the count will be empty as it couldn’t make the count request.
So, yes the count is available, but only because you asked for it in the debugger.
TLDR, when you open debugger on an RG, it makes a :count request to get the count. It’s not accessing something that’s already been requested.
I didn’t know before I just checked - but the docs are accurate in this particular case (though that’s not to say it’s perfect in other cases), where it’s pretty clear that aggregate searches are distinct from regular searches, and that it costs 0.2 WU. I don’t think there’s anything in the docs that would lead someone to believe that the count is loaded every time any search is done.
I’ve helped build apps in the ‘code world’ and we never had to do so many scientific calculations and configurations that took a scientific mind to figure out the cost.
I really hope bubble comes up with something better.
I like Bubble…but I think they can do better with their pricing model.
I know, I’m not trying to be overgenerous to Bubble and there’s still a lot of work for Bubble to do on WU (lots of which should’ve been done months / a year and a half ago) but I was just pointing out that this particular instance probably isn’t the worst offender out there.
For example, that :first item is empty / :count is 0 bug is now finally a ticket in Bubble’s system thanks to Fede bringing it to attention again so hopefully it’ll be attended to and more bug fixes will follow where they’re necessary.
Hoping we’ll get some peeks on improving observability shown at BubbleCon. And again, like you, I do really wish stuff like that was in place when WU was announced in the first place. But, we’re here now, so I know I’ll be trying to help Bubble do the best they can, even though I don’t agree with everything they do!
When you open the debugger, a new aggregate search is run to get the list in the RG. You’ll see that if you load the page, turn off your internet, then open the RG in the debugger, the count will be empty as it couldn’t make the count request.
That sounded plausible. I just checked and it is not what I am experiencing.
It may be that in your RG, you are showing the entire list (i.e 4 out of 4 items). The debugger might be making an optimisation that will prevent the :count request as it knows it has found the last item (from the search request), and knows how many are already in the Repeating Group. In that case, it would be nice if Bubble made the same optimisation on their end, but there’s a whole host of reasons that that exact change might not be possible.
It’s never as simple as us lowly Bubble devs like to think - I imagine that when Bubble checks a count in a workflow, for example, it has to do so again because the method the debugger uses to check the count might be different and manipulateable on the client side, which you wouldn’t want to be possible with your workflows (maybe someone wants to take a poke around the debugger code and find out, but it’s not going to be me)
I’m using a text element with dynamic expression referencing the repeating groups list of things count.
In your video, the experience is different than mine, so I thought to check with another approach.
In my first attempt, the text element was on the page still, which is referencing the RG list of things count…when I turned off the internet, I could see on the RG the list of things count.
So, I tried with deleting the text element, previewing the page, then turning off internet, and now the RG list of things count is empty, although it should be 4 because that is how many items are in the RG.
So it would seem that the text element reference to the RG list of things count, forces Bubble to do the aggregate count and then they apply it to the RG.
What is strange about that though, is I would expect that the count would be how many items are in the RG at the moment, and not the total count of all items from the database. If we use an RG with an items from or items until operators, the RG list of things count shows only the number of items in the RG, and not the entire count of things that would have been fetched from the database. Meaning, since the fixed number of rows is 4 and the search only returns first 4 items, why then would the list of things on the RG be greater than 4? Bubble must be somehow registering that the datasource was searching for all items and assuming that although the RG has a fixed number of rows, and is only showing 4 items, that the reference to the RG list of things count actually wants the number of things that the datasource would have returned rather than what the actual count of things in the RG is.
It’s so easy to do like for loop or do while condition in other languages.
But We can only use recurring workflow to implement some simple functions. It’s so slow and expensive….(wus and wus)
And in some cases infinity loops occurs while the condition fails… even the logic is right in other languages.