Using the same "search for..." multiple times

Would using the same “search for…”, with the same criteria but in different contexts within the same workflow, or reusable element, cause multiple requests to the server or does Bubble recognises that this request has already been made and already received a response?

For example:
In a backend workflow, I need to update a thing based on a search for… :first_item
then in the fields to update, I need to query an option set and use :filter to return a single value. When I use the filter, the context of the “This…” variable changes and I no longer have access to the “This thing” but only “This option set” so I must run a search again to retrieve the reference…

Thanks a lot for your help fellow bubblers!

1 Like

Using the same search does not guarantee that the search isn’t re-run. Its bad practice to re-use searches, use Result of Step X instead.

On the backend this might mean running a ‘Make change to list of things’ without actually changing anything; this will essentially just run a search. Use that step for all future references.

In the frontend this still generally applies. Instead of using a make change to list of things, use a repeating group with no children elements, but set the datasource to the dataThings you want to reference in multiple locations. You can then reference ‘repeatin group’s list of things’ to avoid running the risk rerunning that search.

This technique also helps with development, because if you need to change the parameters of the search, you just need to do so in a single place.

1 Like

Hadn’t thought about using changing a list of things without actually changing anything just to use that list as a workflow reference. Good idea. Bubble really should consider adding states to backend workflows.

Just be aware…

Using ‘Make Changes To List Of Things’ will cost you WU for making changes to that list (even if you don’t actually make any changes)

So if it’s a big list, you’ll be racking up WU cost for the search and for making changes to every item on the list.

I usually use List Popper & Friends’ Flow State list for this instead (but yeah, Bubble really needs to have some native backend workflow variables)


Good to note.

1 Like

I ran into this problem myself recently — In some cases, I lose access to my “This…” and it causes me to have to go in circles to get access to the data.

I vaguely remember seeing something from Bubble that this is on their list… however, not sure!

Thank you for pointing it out! I must have tested it wrong when i ran my WU experiments. I thought that the WU costs were proportional to how much data needed to be changed.

Will start using list popper & friends.

Couldn’t agree more, real crazy how it hasnt been implemented yet.


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