Hello everybody. I would like to display items from a list in the repeater group from newest to oldest, as is normally the case in a chat .
I use the timeStamp field to perform sorting. But it turns out that when creating this sorting, the response and display time of messages is brutally increased.
I’ve already tried “search for” and also a field list of messages, but both have a very long delay in the response of the messages, since when I don’t insert any order, the presentation of the messages is almost instantaneous.
The tests were with an amount of approximately 500 messages for this user the total number of messages in the database is 45 000.
1 - Messages without any sorting in message list field.;
Add privacy rules so that only the intended user’s messages are sent from the server over to the page. This reduces the number of messages to be managed, sorted, searched, filtered … etc.
you can also reach out to support@bubble.io via email as I am a little surprised it takes this long. one question before this:
in each chat message in your repeating group, i see you are using "parent groups messages conversation:find & replace… find replace… what is reason for this? why not just parent groups messages: text.
also be sure not to have “do a search for inside do a search for”, ie nested search. or search:filtered anywhere.
As for using find & replace, it is because I receive these messages directly from the WhatsApp API that contain ** for bold and __ for italics which I replace with regex for [b][/b] or [i][/i] as in picture below;
I don’t do any search for within the message result
oh ok so it is not just a normal chat with 1 chat and its many text message but in each repeating group row you use the whatsapp API to gather more data? not surprised this is slow.
can you share the datasource and details for this?
Each message sent or received on whatsapp is created a new message in the app. So I do a search of all messages exchanged with the selected chat and present them in the RP, no queries are made within the RP either internally or via the API.
A sorting delay can arise when Bubble is forced to download all data client side (to the browser) and then sort from there.
See the below from Josh related to sorting…
I.e., if you have 10,000 items and are only showing 10 in the RG, if your sort is done server-side (by Bubble) it quickly finds the 10 you need and only sends those 10 to the browser. But if you sort client side (on the browser), then Bubble needs to download 10,000 items to the browser and then sort them there.
If you are using APIs to pull in data from outside of Bubble, that’s beyond me since I’ve only worked with data stored in Bubble. However I can speculate that there could be a scenario where you are asking for a sort, which forces Bubble to download all the data from the external data source, and then do a sort on the browser (client side). To get around this, I’d think you’d need to set it up to where the API is asking for sorted data from the source, so that only the results are sent.
In your Google devtools screens which you’ve screenshot, you can click around in there to see exactly what is being loaded. I’ve found that’s the best way to understand exactly what Bubble is doing.
lets say my chat has 20 messages.
do you want to add a constraint to only display 10 of them?
in this case you do not do this in the api query but in the frontend so you make datasource of the Repeating group
get data from external api: filtered and add constraint where it says filtered
other option is you want to do something with the “list”
check documentation of another api eg google calendar here they also have a list event.
here in my api connector, see where it says attendees.