How to trigger Server Connect Auto Load on internal page change?

Hi,

It seems a Server Connect doesn’t Auto Load on an internal page change (NodeJS SPA), only on a regular page load.

Is there a way to make this work? Right now I’m using the popstate attribute on the Browser component to trigger a server connect reload when the user goes back, but pushstate is not implemented yet

just thinking out loud, might not work. But could you manage that by an app/page flow, that runs on content page load, which will run condition that will run server connect actions if URL param (eg reload=1) is true? So whenever you want it updated, example going to specific page, mark the param to true to reload server connect (on page or layout page)
(again haven’t tried)

Where is your server action located? On the content page or on the layout page?

Layout page, it’s supposed to run on every page

@ Hinky thanks for your reply - it’s uncharted territory, so I need more time to analyse your comment :slight_smile:

1 Like

You can use the onload event of the view, to trigger a server action load like:

<div is="dmx-view" id="content" dmx-on:load="serverconnect1.load()">
2 Likes

Interesting, this event doesn’t seem to be exposed on the UI

This solution works :+1:

It will be available in the next update.

1 Like

Important point. Something I came across when doing current course. I secured the layout via a server action but then found that login/logout and menu conditions did not work as expected as the layout was never refreshed as I had set the links to internal. Unchecking “internal” forces a layout refresh which solved the issue for me. Wonder if “internal” can be made dynamic with a dmx-bind?

1 Like

Added in Wappler 5.1

This topic was automatically closed after 47 hours. New replies are no longer allowed.