Forum Documentation Showcase Pricing Learn more

"Display Data" or "Set State" to send data to Popups? Pros and Cons?

Hi Guys,

When sending a user to a Popup to edit or delete a thing, we have two options in Bubble’s Workflow:

  • Element Action -> Group Display Data -> Choose popup in Element and Data to Display;
  • Or, create a Custom State on the Popup, and then when on the Workflow: Element Action -> Set State -> Change Value to the data we’re sending.

The first way is slightly easier, as we don’t need to create a custom state, but I’m wondering if there are any pros and cons to each way of handling data sending that affect Bubble’s performance or workflow limits?

Ty!

There’s no practical performance difference here that you could measure. Just send the data to the popup group and show the popup for most simple use cases.

However, there are times when you might want to keep track of a “selected” item that either is being (or will be) displayed in popup, editing dialog or whatnot. In that case, you would feed your pop-up or other thing with data from a custom state.

Again, doing that is not a performance intensive operation and has no impact on the performance of your page on any sort of modern device.

For a practical example of the intersection of custom states and popups, you might want to check out the video I just (re)posted about repeating groups, selecting items in them and operating on them in popups and other types of groups.

(In the latter part of the video, I show how you can track the state of a “selected” item in a repeating group and pass that data to a group where you can edit the selected thing.)

1 Like

As @keith points out, there’s not a major difference. But I’ll tend to use states when I want to track multiple things and to consolidate similar-function popups within my app.

To do this, I set a “mode” of the popup, which has a function similar to having a state value that displays different “tabs” on a page. Then, I create an additional state for each of the relevant data types that may be sent to the popup.

Ex. if deleting a friend, I may set the “mode” to “friend-delete” and the “person” state to the unique ID of the friend to be removed. Then run the relevant workflow (based on the popup’s state) when the relevant button is clicked.

2 Likes

@keith and @dan1, thank you very much!

2 Likes