I am attempting to pass parameters between multiple views, and it's my understanding that this is the preferred way to do so according to the documentation:
In Perspective, Component Message Handlers are the preferred way to pass parameters between components or Views. Doing this involves the system.perspective.sendMessage function.
I have a view where users can query a database which populates the results in a table's rows. Users need to be able to select a row and click a button to redirect to a different view where that row's values will be used to populate a group of text fields and run a named query those values as its parameters to populate a table below those fields.
Right now, I am sending the first table's selection as the payload of a session-scoped message. The other view has message handlers on components that receive that payload and run scripts to update themselves. The line after sending the message runs system.perspective.navigate(). This works fine in the designer. If I click the button that would redirect to that view, I can verify that the other view is receiving the message through console logging, and when I open that view everything is loaded as I'd expect. However, in a live session, the second view is not updating at all. I originally assumed this was because sendMessage() is async, and the navigate() call was opening the page before the message handlers had time to execute. However, I put in a sleep() call before the redirect, and still saw no updates. I then broke the sendMessage() and navigate() calls into separate buttons, but I'm still not able to get the second view to update, or even give any indication that it's receiving the message being sent. What can I do to resolve this? And is this even the proper way to go about this process? Based on my experience with the documentation, I would assume this strategy would be correct, but I find conceptualizing with the async execution to be difficult without promises like there are in traditional web development. Any help or guidance would be appreciated, as I'm quite stumped on how to fulfill my company's requirements re: this functionality using Perspective.