Reload page sections on some action

Hi
I am not sure if I do something wrong, or need to adjust the way I do it, but I seem to experience a random bug on reloading elements of a page on click events etc.

so, i have a page, my client details page. in this page I call a server connect select statement to populate the part of the page, all working so far, I have a link in that section that has a dynamic action on it (update client from active to non-active), which on click will call a server connect, do a small db update, then does a success notification and then reloads that original server connect that displayed the data. I believe I have it all set correctly as this 100% works “sometimes”, but, maybe 30% of the time, it is the same for all of these I have (and I have quite a few), they work, but more often than not i have to reload the entire page to see the changes made but at times the action works as designed.

Is there a bug? Do I need to add some kind of delay between insert, success and reload? (if so how do i add a delay and what sort of delay), it is causing quite a bit of user confusion as my team are clicking, see nothing happen, click again, then its reset back to its original state so click again, and so on lol

thanks

There should be no need for a delay but I guess a simple test would be a good idea to put your mind at rest in case your db server has some sort of queue or cache causing an update delay.
Just add a short wait (under core actions) after the db update in the API and see if it has any effect

You could try combining those on click Actions in to a Flow with a micro delay (say 100ms, or experiment until you get the desired effect and success), initially have No Auto Load selected on them and then use the Flow to load them…? Then fire the flow on click of the button.

How exactly is this set up? Please paste the code, sounds to me you’re not using the success events to reload the data but instead run several events on single click, which is not a good practice.

that makes sense, this is one example of my code

<p dmx-show="SC_ContractDetails.data.ContractDetails.Active" dmx-on:click="SC_ContractUpdateActive.load({id: SC_ContractDetails.data.ContractDetails.id, contract_active: 0});SC_ContractDetails.load({});notifies1.success('Contract set inactive')" class="text-info" id="ContractActive">

so click a link calls the action, the does update, notification then reload

so sounds like i have a slight error somewhere in the flow or something?

thanks everyone for taking time to reply

Yes, that’s the issue. You need to call the server action reloading the data on success event of the server action that does the update. Same for the notification. When adding them all on the same click event you don’t know which of the action runs first.

1 Like

makes perfect sense. thanks just have to figure that bit out to do it, will have a play, thanks

sorry. struggling to pick up the ‘success’ element, right clicking on dynamic events does not show server connectl going into my click event doesn’t show anything, my sql that does the update is set to ouput (thinking it might output the success/failure). Do i need to convert to inline flow or something? I just assumed the way I did it that it would do the steps in the order they were in my list, thanks

In the App Structure select your update server action > dynamic events > server connect > success

1 Like

works a charm now, thanks for the help, all a learning curve :slight_smile: thanks

1 Like