On content page: set up a Server Connect which is connected to a database query. Give the query we set on the lay out page (step 2) as input parameter:
Load the content page with the parameters in the URL, this will just trigger the server action and it's query once (it's get_lecture_video?lecture_id=7) in below video
Now click on one of the buttons set up in step 3. This will now trigger the server action twice. See the video:
Extra:
7. If I now remove the input parameter in the server action
It is indeed related to routing. The server connect detects the url change and then loads the content of the new url, at the same time the new content page is loaded for that url. When the content page is loaded it injects a new server connect and that one also loads the url.
It is not really a bug, server connect component loads the new content when it detects the binded if changed, at the same time the view loads a new content page and after the content page is loaded it injects a new server connect component which is loaded.
As a workaround you could try using a server-side template for the url of server connect.
I’ve drawn out a diagram to show you what my goal is.
I have a feeling that I’m making a fundamental mistake and now need some workaround to duct-tape flawed logic.
Please take a look and tell me if it’s set up correctly
The Wappler UI currently only has limited support for server-side rendering, it allows you to insert server bindings in text content, title and meta tags. It is not yet possible to insert it on attributes of components.
You can edit it in code view if you are up to it, for the templates in NodeJS EJS is used (https://ejs.co/).
An other option is to remove the :lecture_id from the path and pass it as querystring parameter, you then don’t have the url but the view will not reload when the querystring changes and it will only update the serverconnect component on the page.