Bug on sc reloads in app connect (sometimes)

Latest wappler, php project, windows 10, running in xamp.

I have a page that runs a SC DB query, this is rendered onto the page just fine. In that page I have elements that update the initial SC DB query, maybe adding a message etc.

I do all the reloads on the initial SC on the changes, and sometimes the page shows those changes immediately, but more often than not it doesnt, there is no pattern to it, its just 50/50 whether the changes made will show in the page or have to reload the page for the changes to show, on a reload the changes are always there, so its some delay in the reload.

If its not clear I can try to demonstrate it over zoom/team viewer etc, or try to make a video showing it (not quite sure how on that front)

thanks
Darren

Hi,
Which field do you see that is not getting updated after reloading the SC?
Delay means the changes will show, but just after sometime. From your description, if you have to reload the page, there is no “delay”. The SC is either not reloading or something else is wrong.
Also, try checking the console for any warning or errors.

its not a field per se, as its a region of the page, on the page if I am an admin user I have edit/delete buttons on the page to manage data in the page. My reloads must all be setup correctly because sometimes it works perfectly, I click delete, boom its gone, another time I click the same button and the item i deleted remains (until I do a full page refresh). I can see I have the reload in the action (and the fact it works sometimes means it is setup correctly), it really is 50/50 if the page will display the correct data so I am fairly certain it is a bug in wappler.

as can be seen in the two uploads, i have the delete icon, clicking that calls the action in image 2, and that has the delete + core reload, sometimes it works, sometimes it doesnt. I just clicked it now and nothing

So if I understand this correctly, you have two server actions that load on click of the button.
One deletes & other reloads data. This is where the issue is.
All actions are preformed synchronously. But this does not mean Wappler/DMX will wait for the first action to complete before executing next - with respect to SERVER ACTION load.
So, what’s happening 50% of the times is that delete is completed before the second guy is called. And rest delete is still running and second guy fetches the data.

So basically, this is a coding issue and not a bug. I am not sure if this is explicitly stated in Wappler docs, but now you know.

How this should be setup:

  1. On click of button call the delete server action load method.
  2. On success event of delete server action, load the main SC.

This should give you accurate results 100% of the times.

Adding to sid’s explanation, it’s explained how to run the server action on success delete here:

the delete doesnt actually delete, its actually an update to null a couple of fields in the row.

Nevertheless, its the concept that you need to implement correctly.
Call the data fetching server connect AFTER the one which manipulated the data has COMPLETED.

mine are setup as simple links with an onclick event which runs the SC as per the image above, seems an onclick cant have a on success as well, so when its clicked, the onclick event fires which does the delete then runs the page primary sc, but there is some disconnect in timing (guess it does not always do the delete before the reload? even though in that order.

hopefully might have sorted it, more testing needed, so the onclick calls a SC, I run that SC and then on that I do a “on success” to reload the page core SC, hopefully that will work

That’s the way to it, as already explained above.