12
Views
12
Comments
Solved
Invalid call of the 'RefreshDashBoard' client action of the 'MainFlow.Dashboard

Hi all,

I am encountering a error that I cant prevent. In my Reactive web application I want to refresh the data every minute. I have achieved this by using java script. Since a three weeks ago we see the following error:

"Invalid call of the 'RefreshDashBoardOnClick' client action of the 'MainFlow.Dashboard' since the latter is not currently active. This is likely due to a platform's client action being used as an event handler or in a setTimeout function. Consider removing this call by using the 'On Destroy' event of the screen/block or moving your logic to a global client action."

previously this error occurred around 500.000 times a day. I have reduced this amount to around 400 a day by making sure that the java script is only run once. Now the first time the application is opened within a new browser window the error still occurs, however after refreshing this window once the error does not occur. 

I have tried to call the javascript in multiple ways and currently in the OnRender event. the L_EventTrigger prevents the java script from running multiple times. In the OnDestroy Event I clear the interval as suggested:

OnRender:

OnDestroy:

We are running Version 11.7.3 (Build 7036). Does anyone have a solution for this error?

Rank: #1108
Solution

Apparently the splash screen was causing this issue. After removing the splash screen the error wont appear anymore. Since the splash screen is not essential we have decided to live without splash screen

Thank you J. and Jorge for your help! 

mvp_badge
MVP
Rank: #18

Hi Jørgen post,

On Render will be triggered every single time something visible on the screen changes. This is not what you want. For the behavior you desire, you should be using the On Ready event, that will only be triggered once when the page first loads.

Hope this helps!

Rank: #1108

Hi Jorge Martins,

Thanks for the tip. I knew about the triggering of the OnRender event however, I first tried this script in the OnReady event and encountered the same issue that the first time it runs errors and after a refresh it works. The OnRender event is where I stopped my troubleshooting :)

It seems to me that the client actions is not yet existent in the browser or something and therefor the javascript is unable to reach it.

mvp_badge
MVP
Rank: #13

Hi,


It's indeed a bit weird.

In any case I have a similar webblock, only I use the OnInitialize.

$parameters.timeoutId = window.setInterval($actions.EventStatus, $parameters.IntervalInMs);

note the timeoutid, which holds the id in the ondestroy event.

and

in the onDestroy

if($parameters.timeoutID > 0)  {

    window.clearInterval($parameters.timeoutID);

}



mvp_badge
MVP
Rank: #18

Jørgen,

Do you face that error if you open the offending screen directly? or only when you navigate to it from another screen?

Rank: #1108

Jorge,

Its the main screen of the application so its opened directly

Rank: #1108

Seems like calling the javascript in the OnInitialize with adding "window." to my javascript worked! 

EDIT: Damn i was to early it still occurs, however it seems to occurs less

mvp_badge
MVP
Rank: #13

beware, that you have to make sure the js is destroyed, since react act like a SPA.

so when you navigate to a different screen, the actions are out of scope.

hence you need to absolutely make sure to destroy any "dangling" events like tiemouts.

.


Rank: #1108

True however the error occurs while the screen is still active. The OnDestroy seems to be working because there are no errors after closing the screen (or navigating away)

mvp_badge
MVP
Rank: #13

Well,

If you can provide us with a sample OML that reproduces the error that would be very helpful :)

on that note, on which platform version are you currently?


Rank: #1108

Hi J,

I have uploaded the IPP free Sample OML. If you open it within you browser (i use chrome) and open the console you will see the error after 1 minute. 

Currently we are running Version 11.7.3 (Build 7036).


CloneOfReactive.oml

Rank: #1108
Solution

Apparently the splash screen was causing this issue. After removing the splash screen the error wont appear anymore. Since the splash screen is not essential we have decided to live without splash screen

Thank you J. and Jorge for your help!