While configuring a NodeJS SPA project in Wappler, I have a requirement to do some work on on-show event of a route.
There are various such dynamic events for this in PHP/ASP.net SPA “route” component. Since there is no such component used in implementing SPA in NodeJS, is there any way to achieve this?
My use case right now is to scroll the page to top on load of route. Setting page to scroll on every possible link is not an acceptable or practical solution.
Other use cases which I have had mostly include calling a server action when route page is shown so that even if page is loaded from cache (which does not invoke auto-load), the data is always the latest.
I suppose that you use the new view component now? The view component does work very different then the route component, it doesn’t show/hide its content. You probably want to listen to the load event, it is triggered each time new content is loaded for the view.
On the content page, I added the App->Load event, and this is the change I see on the page.
But, the alert is not shown even once. Not on first load… not on redirection… not even on direct page load via URL.
This is the place you asked me to configure the load event of somewhere else?
This works.
Is there a plan to put these events on the content page level itself?
Because here I will have to put in conditions to identify which content page is being loaded to perform specific tasks.
You can try using a flow with auto run on the content page, it should run each time the content page is loaded. Same is for server connect and script blocks.