Server connect triggered multiple times?!

I honestly feel stupid and need a little help here…

I’ve made a video to show the problem, here’s the explanation :

  • SPA with nodejs (using 6.00 rc1 but was doing the same thing 5.8.2)
  • When accessing “conditional region” that has a specific server connect; the server connect will trigger multiple times. Even more if I click on another link and come back.
    – Example : I get on conditional region “files” on a member’s page : server connect (that is a read action on database) will trigger 1-2 times… If i leave this conditional region and come back, it’ll trigger 4-5 times… and so on…

I tried applying some specific dmx-bind:noload conditions (like when data is not null = noload) but it keeps on doing the exact same behavior. (noload will work if I give it a condition to never load but not if i tell it to wait for member_id to be loaded or to check if data is already loaded…

Here’s a video of the behavior, any suggestion would be greatly appreciated.

Thanks a lot :slight_smile:

Hey @Future,

Your serverAction member_files is in AutoLoad… This mean ir run on page load.
So, the parameter member_id you have there is getting the value from your variable memberdetails.
This variable is null when page loads and your serverAction member_files is running first time with parameter member_id=null.

Then you assign a value to your variable and that triggers again your serverAction.

I haven’t understand (don’t hava time to examine the video) where this variable takes the value.
A solution:

  1. Set your serverAction to “no Auto Load”
  2. In the exact moment that you assign a value to your variable then you load your serverAction with the correct/final value of its parameter member_id

I think I got it right and helped you…

1 Like

Hey, really want to thank you for your time :slight_smile:

I found out that my main problem is the way i thought things were working in Wappler because I’m an ex Bubbler… All my containers were Partials instead of “Content”, and clearly, putting a server_connect inside a partial is “challenging” to say the least haha.

Most of my stuff is fixed, working around some minor details hehe.

PPS : If staff reads this; i love wappler, but a lot of documentation needs to be updated… I think it would really help with adoption from new developers.

1 Like