Using :plus item on a repeating group results in removing duplicates from the original list

In my app, I have a list of texts that I want to display in a repeating group. I’m using the :plus item action on the data source for my RG to add something onto the end of my list (for auto scrolling). However, using the :plus item action removes all of the duplicates from my list.
The docs say:

…:plus item
This operation adds an item to a list of things. It returns a new list with the original list plus the new item. If the new item is already in the list, it will not be added.

Here is an example with a couple repeating groups with and without the :plus item operator.

The reason I’m adding PLACEHOLDER is that the last item in my list is a streaming response from an external source and I have a workflow that runs once a second to scroll to the last item in the list (PLACEHOLDER) so that the streaming response is visible to the user as it comes in. Any other suggestions for auto-scrolling to the bottom of a RG would also be appreciated.

1 Like

Hi @hils.hpe,

That’s known behavior. Bubble automatically prevents duplicates in lists. The fact that a list of “text” items can initially contain duplicates is actually the undocumented behavior.

As you point out, the documentation states…

If the new item is already in the list, it will not be added.

A corollary to that statement (which I don’t think is explicitly documented) is that performing most list operations forces Bubble to “dedup” the list. I say “most” because the “minus item” operator does not (unless the item being removed is itself a duplicate item). But merging, intersecting, minus list, and plus list do force a dedup.

As a result, it’s safest in most situations to not rely on the undocumented behavior that lists of “texts” can initially contain duplicates. Whether that’s intended behavior, I’m not sure. You could certainly check with Bubble support to find out.

Thanks for clarifying Sudsy. It’s unfortunate it works that way. Should probbaly be an option to dedupe or not. I can think of lots of reasons both ways. And at the very least documented as that’s how it works.

It’s crazy that all list operators ‘dedup’. They have a ‘unique elements’ chain if you want such behaviour…

This topic was automatically closed after 14 days. New replies are no longer allowed.