I have a case where it seems like my flow functions are not executing in order, or perhaps I misunderstand something.
I have a composite component that has buttons within it that fire a
Component Tap event. I use that event to execute some logic internal to the component and then trigger a
Button Tap event at the external component level. However, the
Button Tap event at the external level appears to fire before it was triggered internally. I had to put a Delay on the external event chain in order for things to work at all.
Here’s the internal event chain:
The external event chain:
And here’s a screenshot of the debug log from the Preview app when I tap the button:
You can see that the external logic begins firing almost immediately, well before the internal logic actually got to the Button Tap event. I thought something else might be triggering it, so to test it I disconnected the event trigger, and that kept all external logic from firing, so I’m pretty sure there aren’t any external factors coming into play.
Why does the external logic get triggered before the internal logic completes? Do flow functions actually happen in order?
Hi! The flow functions to happen in order, but the button tap is probably triggered when the button is tapped. Instead, use a blank Receive Event node that you trigger with the Trigger Event.
That’s what I did, I just named it “Button tap” for consistency. My composite component is custom, so there’s no default “Button tap” event. As mentioned above, I tried removing the trigger to see if this event fired anyway, and it does not. (App id 169788, page: Scale Point Section.)
Hmm. Looking at your app I couldn’t quickly find anything obviously wrong, so I’m not sure. I couldn’t find the page in your app either as it wasn’t in the tabs, so I wasn’t able to test anything, but I would recommend trying the following things as a workaround/debug thing:
- Move the “Button tap” logic onto the page canvas instead of the logic canvas of the component (I recommend this in general for the structure of logic anyway)
- Convert Range item into a container instead of a composite component, and see if that makes a difference
- If neither of the above make a difference, take the Range item out of the Conditional renderer and see if that makes a difference
This is only if you’re certain nothing else should be triggering the button tap event. If you think there might be a remnant of it somewhere, check that first.
If you find out what fixes the problem, let me know! This looks quite a complex case to reproduce although there is a good chance there is a bug, so it would be good to know what has to be changed so that the bug isn’t there anymore so I can work my way backwards to find it.
If none of the above help, let me know and I’ll see if I can reproduce this without that knowledge, but it will take some time for the fix to be ready so if you find a workaround, that’s better for you.
how do we convert it back to a container?
There is no way to convert it to a container anymore, as composite internals have changed to include internal properties etc. that can not be converted into the mode of it just being a container.