It would be great if there was an option for content pages to reload all Server Connect and API data within the content page when a route is loaded (obviously excluding those marked as no-load).
why you dont use flow actions ?
You’re right, it is an option but is more time-consuming than it should be. I think having something like a checkbox on Server Connects / API connects to update whenever the page/route is visited (or not) would be a quick and easy method without having to create the Server Connects and then trigger them within another Flow.
It was also complicated further in my case because I am using buttons where the route is set dynamically so calling it from the click wasn’t an option. As a result, I have to also have to set up a dmx-on:load event on every route to trigger the flow that then calls all the Server Connects for that content page whenever the route is visited.
This is not a logically correct approach. Because some SCs may need to be run conditionally or take different parameters. Or, after running a sc, a different sc may work according to the result.
Also, if you are going to use the same SC data every time a page is loaded, it shouldn’t be that way anyway.
**** You can also do this already after adding a route.
SCs already have the option to Auto Load when a page loads but it doesn’t give the option to update when revisiting a route (without the page being reloaded). They could be set to do that based on local/session storage or other parameters that are defined in the SC settings, which is what I would anticipate doing.
I appreciate it will not be suitable for every SC so I would want the No Auto Load option to remain but maybe extend the Auto Load to encompass route visits or have 2 Auto Load options - e.g. default, every route load
are you using SPA ?
Well, trying to…
Routes are being cached, so they are not loaded again when you visit the same route the second time, it uses the already loaded version. We could make an option on the route to prevent caching so that it reloads and also reloads your server connect that way. Better is just to use the show event, it is being triggered when the route is being shown and you can trigger the load of the server connect there.
Personally, I would find the option very useful. My route pages are part of an admin system which needs fresh data each time a route is visited. I could use (and currently am using) the on show event to trigger a flow but this adds several extra steps (adding all the relevant SCs to a flow and then creating the on show event that links to the flow) that could be solved with a simple check box. If I alter the page and add a new SC, I need to remember to also add it to the flow every time.
I appreciate not all would find it useful, but I certainly would.