7
Views
4
Comments
Error in ApplicationLoadEvents - OnUpgradeProgress / OnLoadComplete
Application Type
Mobile, Reactive

Hello,

I am facing an issue in the Mobile and PWA application while using OutSystemUI web block Private/ApplicationLoadEvents. 

Private/ApplicationLoadEvents web block has two events OnUpgradeProgress and OnLoadComplete. The web block is nested inside our web block named ApplicationUpgrade (present in all layouts). In the OnLoadComplete event, we are handling internal updates/upgrades of our application, and OnUpgradeProgess is only used in the Splash screen to show the progress of the loading bar. Now, since the web block is present in the layout, both events OnUpgradeProgress and OnLoadComplete are triggered for every screen/page regardless.

Now the issue is if the user navigates away from the screen while it was still loading ( Private/ApplicationLoadEvents events still processing), we get the following exceptions:

  1. Invalid call of the 'TriggerOnLoadComplete' client action of the 'MainFlow.TimeEntryDetail' 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. 
  2. Invalid call of the 'TriggerOnUpgradeProgress' client action of the 'MainFlow.TimeEntryDetail' 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.2

We have tried to solve the above-mentioned exception using OnDestroy as well as clearTimeout but the exception still throws because the execution of events of ApplicationLoadEvents has not been completed.

Thank in advance 

Regards, Wasif 

Rank: #4088

Dear Wasif,

It seems like this is a known issue of the platform. Please follow the link below for the probable solution:

Mobile apps: How to use OnDestroy to avoid Invalid call of the * error? | OutSystems  

With best regards,

Shounak

Rank: #1827

Hello Shounak,

I have applied the solution mentioned from the URL already and it doesn't fix my problem.

Thank you

Regards, Wasif

Rank: #54

Hi Wasif,


Indeed this problem happens when the handler is called and the page is already destroyed.

I solved this problems by adding a local variable to the layout called IsDestroyed which starts at False.

On the event handler OnDestroy, I set this variable to True and then on the handlers, I only do screen interaction if the IsDestroyed is False:

Something like the example above.


Hope it helps.


Regards,
João

Rank: #1827

Hello João Marques,

I have used IsDestroyed variable logic from OnDestroy (as you mentioned above). But the issue is that the Private/ApplicationLoadEvents keeps triggering the OnUpgradeProgress event which creates a trail of exception in our service center error log.


Thank you

Regards, Wasif