New free plugin (9 march/20) - Satellite, trigger worfklows in reusable elements from the page and vice-versa

Hi @pprasquier , @romain1304 - I’ve built an example for you to show how it works.

Hope this helps other fellow Bubblers.

Demo:

Editor:

2 Likes

@GhostCodes Nice one!
However, instead of using every 0.1 seconds, use an event:

image

As in send data, trigger event, then inside the event in the reusable read the data :blush:

Oopsie! :slight_smile:

@vini_brito I have tried using the other two actions “Antenna Revealed, Antenna when triggered”, and they both don’t do anything once I send the data. The only thing that still works is the “check every 0.1 secs”

EDIT:

chrome_ju2BSEf1OR

When I tried your method, I get a failure. You can check my live code. I’ve tried a few different ways, all of which gives me the same error.

EDIT #2:

WHOO!!! GOT IT FIGURED IT OUT THE RIGHT WAY! :slight_smile:

Check out the example now, it should be the way you’d designed it to work! Now people should be able to use this example.

1 Like

able to solve what seems to be the same as yours issue by making sure you Antenna is always visible (when I got the error, the antenna was inside of a group which had conditional hide for mobile breakpoint)

1 Like

Also having problems sending data to Antenna.
@vini_brito sent you a PM with my console log…

Thank you in advance.

Hi Vini Brito,
I am having a very weird problem.

When running the app with ?debug_mode=true in the url, everything works. (It works also without the step-by-step function activated), however when debug mode is removed, the antennas stop working.

I thought it was a timing mistake, where the step triggering the “trigger antenna receptive to satellite” step was being fired too soon, but i tried putting the actions in a custom event to avoid timing problems and the issue persists.

And I cannot use debug_mode so i cannot find the root of the problem. In debug mode it always works.

Thanks for your time.

EDIT:
Ok im at a loss of words. I wanted to check whether the antennas were being initialised, so I put a “Set State” action in the “Do when Antenna is revealed” workflow. I set a number state to 1, and put a text element displaying the state.
This was to check whether the workflow that initialised the antennas ran.
For whatever reason… this fixed the problem. With this extra step, everything works again. If i delete the text element, the previous issue reappears.
I am so confused. Can somebody please explain why this might be happening.
I liked to think that bubble is very deterministic and everything makes sense, however this issues (and how it was solved) really puts that belief to the test.

2 Likes

There is a reproducible bug when using Satellite in an reusable element in a repeating group.
Simply put, if an antenna is in an RG, the changes to the cell’s thing by this antenna is temporary. You can see the changes momentariliy, but it’s not saved in the database.

My tempoaray fix: put the changes you want to a custom event. in the antenna, schedule this custom event instead of triggering it. the changes will be permanent.

Context:

  1. Data Thing: data_holder, a data thing that as 2 text fields, i.e., “id”, “content”
  2. Reusable element: “test_satellite”, an RE holding a satellite, with a custom event that takes a “callback_id”, and “callback_content”, which will trigger send the data to an Antenna and trigger that Antenna.
  3. Reusable element: “data_holder_display”, an RE that display the “id” and “content” of a “data_holder” thing. It contains an RE “test_satellite”. It also contains an Antenna that is initialise to receive data from the Satellite. It contains a button that will trigger the custom event in the test_satellite that sends a new content to be assigned to the thing.
  4. Page: RG_page, a page with a repeating group with the data first 4 data_holder. Each cell contains one data_holder_display to display the cell’s data_holder.

Bug:
Data is successfully sent through the satellite and antenna, and the supposed change to the cell’s thing can be seen in the page. However, this is not a real change to the database. Somehow the changes are not saved. When the group is reset or the page is refreshed, the changes are gone.

There are exceptions:

  1. The changes of a first trigger is saved when a second trigger is sent. The second trigger is not saved. And so on and on… It’s always the last trigger that is not saved.
  2. Also, when the changes are done in a “scheduled custom event”, the changes are saved.
2 Likes

Can you make a free app with this happening? Only way I can have a chance of ever fixing it :yum:

1 Like

Exactly same issue here, I think it’s because the way bubble is handling the order of operations in a workflow.

I reproduce the error in a simple app here (simple scenario of a confirm box on a repeating group) : free-app-satellite-issue | Bubble Editor

To show the issue :

Click on a cross, refresh.
Deleted element is back

If you can help us to solve this, it can be really helpfull !

3 Likes

Hi @vini_brito great work with this plugin.

i however noticed that it is not able to send option sets or text. Were you able to resolve this? what can we do make it work?

hI everyone so i was able to see a workaround for the issue with option sets. Just make sure the option sets are all lowercase with no spaces and it should work. I will try with other option sets and share updates here

Hello @vini_brito
I have read the forum and still do not understand if Satellite can be used in a repeating group.
I have two repeating groups: the first with data and the second with the number of pages of the first. In the second repeating group I want to display reusable element with focus group where you can type in a page and go to that page in the first repeating group. But I don’t know how to pass data from Input in repeating group to the page. Can Satellite do this?


Here is a link to a simplified version of what I want to achieve My-test-app-everyone | Bubble Editor

Try pairing it with the plugin Orchestra. Unsure if it will work for what you want but it would be the first thing that I would try.

1 Like

Hey, @chelovekius, you won’t be able to fully encapsulate the logic part of this inside your reusable element. A couple of things to understand:

First, reusable elements can transmit and receive values to/from their parent element via custom states located on the outermost container of the Reusable. This is a touch buried in the Bubble docs, but as it states “Note that the outermost group is extremely important, because its custom states can be accessed and set from workflows on the page that the reusable element is added to.

So, here’s an even more simplified version of what you’re trying to do…

To let your reusable share its selected page number with its parent element, create a custom state on the outermost container. Here I’m doing this by clicking the (i) (“inspector” button) on its property inspector:

And then in the workflow for the button click, we “publish” the value that’s been selected in the input by setting this custom state:

So now your reusable can at least passively communicate with the outside world. (That reusable elements cannot trigger events in the same way that element plugins can is kind of a weird oversight, but whatever. You can’t have everything.)

When the input is changed, the new selected page value is put into this state and, in your page, other elements that are “in scope” can see this value, in this case as Page Selector's Selected Number.

Now you’ve put your Reusable element in the cell of a Repeating Group. As you’ve discovered, this severely limits the scope of other elements that can “see” it. It’s only available to other elements in that cell (for pretty good reasons, of course).

Personally, I’d not do this the way that you’re doing, but I suspect you’re wedded to this idea.

So now this is where element plugins come in. @vini_brito’s plugins are clever, and he’s a cool plugin developer, but any element plugin that triggers Events can live in a Repeating Group cell and that plugin’s Events can be seen at the page level (“outside of” the Repeating Group). This is useful to know in general, but here’s how it’s useful in your specific context:

If you have a plugin that can watch for changes in the value of some expression and then trigger an event in response, now you can detect changes inside of the repeating group cell. I have at least 2 plugins that do this: (1) List Shifter (from List Shifter) and (2) Floppy Expression Watcher (from my commercial Floppy plugin).

Here’s an example using List Shifter (which frankly is a little code-heavy for this application, but it’s a very common use case, also, you might discover that List Shifter can generate lists of numbers and also has a pagination mode).

In short, List Shifter will throw its Initialized/Updated event (1) when it’s first initialized on the page and (2) whenever the value of any of its input fields changes. And it echoes the new value to a couple of different exposed states.

In this case, we just want to watch a scalar value (Page Selector’s Selected Number) and we can do that like this. Include a List Shifter in your RG cell and configure it like this:

That’s it. Now in your workflows you’ll have access to a new element Event “A List Shifter Initialized Updated” and we can use it like this:


:point_up:When that List Shifter throws Initialized/Updated and it’s “Scalar” output is not empty, do something.

Inside this workflow, we have access to the List Shifter’s outputs and we can then put some value – like the updated value of the Scalar output (which contains our new page number) – into a custom state where anything else on the page could see it, or take further actions (like triggering the RG’s “go to page” action and passing it List Shifter’s Scalar, right?).

Anyway, here’s an example workflow:


:point_up:Set some custom state


:point_up:Fire some other action (here an alert, but this could just be go to page because the repeating group in question is in fact in scope. :point_down: (my example page’s RG doesn’t have pages, so this is pointless in my case but note that YOU could do this):

As I mentioned, you could do the same thing using Floppy Expression Watcher from Floppy and it’s a LOT lighterweight than List Shifter, but there you go (it’s literally optimized for this specific task without all of the other amazing features of List Shifter).

Demo with editor link: https://list-shifter-dev-test.bubbleapps.io/version-test/simple_rg_with_group?debug_mode=true

(Of course, my demo Reusable isn’t fancy like yours and shows/hides, but that’s not relevant to this example.)

4 Likes

Thank you for such a detailed explanation! Now at least I know that it is possible to trigger a wokrflow from a repeating group. Only at ListShifter Scale after setup does not reset in any way. And if I moved from the first page to the fifth and want to go back to the first page ListShifter will always throw to the fifth page. I added another Custom state and everything worked. Here is an example. The first pagination works as it should. The second with an error (try to go from the first page to any page and then come back to the first one.) The third just shows how Scale is not reset. I tried different ways but Scale is not reset.

@vini_brito Vini, just wanted to stop by and say thanks for the plug-in. It helped me tremendously with a reusable that seemed to be impenetrable otherwise. Cheers.

3 Likes

Amazing job @vini_brito

I am new to Bubble, a month in. I found this article has helped a lot of people. I looked through the entire thread but it seems I am the only getting this error. How might I solve this? Thanks

Screen Shot 2023-06-14 at 18.16.44

Hello… Am I doing something wrong or is this error known?

satellite_plugin_error

1 Like

Does Satellite work if placed inside a nested repeating group to trigger a workflow on the main page? Thanks!