I have been placing data/resource logic in the Page mounted event in the Data Variables area, and UI logic in the Page Layout version of Page mounted. I copied and re-connected the Data variables nodes to the Page Layout area and it seems to work.
I’m just wondering why the separation and whether I could be in for trouble later.
I believe they are the same. In fact, Data Variables and Page Variables are mostly the same too, at least in terms of their scope.
Hmmm. Thanks for the reply, @JOHN_WORSHAM.
The Data Variable presentation of a logic canvas seems separate and tied to each variable. The Page Mounted there doesn’t start with the Hide spinner node, as an example, and the logic canvas is named differently. If you put a toast off the Page mounted in the Data Variable canvas and do the same for the canvas that Page Layout presents, they both run and you see both toasts.
I think we need some input from the AppGyver team here
I’ve wondered the same thing, i.e. is there a right way or preferred way to do it. When you watch from the debugger, it looks as if both threads run in parallel when triggered by the page mounted event (at least as far as I can tell in the debugger; they both start in the same second and I can’t see any smaller time unit there). The way I’ve been explaining it to myself is that AppGyver sees the multiple page mounted events and takes care of the rest (is that wishful thinking
I’m tracking this to see if there is an AppGyver response. Curious minds want to know…
I copied all of my flows from the Data Variable canvas into the Page Layout canvas (detaching the 1st Page Mounted node but leaving the nodes in place) and the app runs seemingly the same. It has the added benefit of seeing triggered page flows at the same time as the Page Mounted flow.
(It’s such a pain to have t repoint all of the nodes that point to the output of other flows - even the ones that are wholly internal to the copied events) But I can understand why - the internal ids of each node are retained for nodes with pointers to other nodes, but given new ids for the nodes themselves during the paste process.
If I hear back from the AppGyver team that they are functionally the same, I will delete the original Data Variables canvas flows.
Hi @Fraser_Gorrie, as far as I understand, page and data variables’ logic canvases point to the exact same events as the page’s main logic canvas, so technically it doesn’t matter where you decide to place your flows. If you listen to “Page mounted” on several canvases within the same page context, the logic will run in parallel as your toast example shows.
I believe that the main/variable canvas separation is there to declutter the main logic canvas and avoid confusing users who do not necessarily need to understand the variable logic. When you are a more advanced user it really comes down to preference – if you like to see everything in one place, or prefer the separation.
As an example, if you have logic that has dependencies with the outputs of a Get collection node (that might take more or less time depending on the user’s connection), running it all after a single Page mounted event on the main canvas will ensure that the sequence is always correct. On the other hand, you can also ensure this by triggering a custom event on the data variable’s logic canvas once the data variable has been successfully populated, and listening to that event on the main logic canvas. Or by adding all the logic on the data variable’s canvas, it’s really up to you.
Hope this helped!
Thanks, @Mari ! That was a very helpful response that I can act on.