How to remove an event handler in OnDestroy action

How to remove an event handler in OnDestroy action

  

Hi,

We have several similar errors on console in our mobile app:

Invalid call of the 'GetLocalProfileDataByUserIdOnAfterFetch' client action of the 'MainFlow.HomePage' 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.


So for example we have a screen with aggregate from local storage and OnAfterFetch action GetLocalProfileDataByUserIdOnAfterFetch attached to it. How can we remove this call in onDestroy action for the screen? As it is impossible to associate global action with OnAfterFetch event.


Thank you for any advice.


Cheers.


 

Hey Mykola,

Usually when I have those errors it's because I'm using either a settimout or a setinterval without mapping it to outsystems variables.

If it's the same problem, you can have a local variable of type object, on the js node you have an output parameter of type object and assign it to your local variable.

On the onDestroy event you clear your timeout/interval and it should work.

Cheers,

Henrique Batista wrote:

Hey Mykola,

Usually when I have those errors it's because I'm using either a settimout or a setinterval without mapping it to outsystems variables.

If it's the same problem, you can have a local variable of type object, on the js node you have an output parameter of type object and assign it to your local variable.

On the onDestroy event you clear your timeout/interval and it should work.

Cheers,

I think it also happens when the OnAfterFetchEvent is triggered but the user navigates away from the screen or weblock to another screen. 

Daniël Kuhlmann wrote:

Henrique Batista wrote:

Hey Mykola,

Usually when I have those errors it's because I'm using either a settimout or a setinterval without mapping it to outsystems variables.

If it's the same problem, you can have a local variable of type object, on the js node you have an output parameter of type object and assign it to your local variable.

On the onDestroy event you clear your timeout/interval and it should work.

Cheers,

I think it also happens when the OnAfterFetchEvent is triggered but the user navigates away from the screen or weblock to another screen.


I also encountered this issue. Have you figured out how to fix this? How can I end the execution when on the screen is destroyed.

No I haven't

Hey Rian/Daniel,

Can you build a small sample and describe the steps when this occurs?

Thanks

Hi Henrique,

I will do, but until then it basically happens that when an async event like OnAfterFetchEvent is still processing, and you navigate away from the screen containt the handler for that event.

Regards,

Daniel

I am also having this issue. What is the solution? 

I am getting hundreds of errors.

Thanks

Hi  Craig, 

Can you share a sample .oml so we can try to debug it?

Cheers

Hi, acutally I have just found an alternative solution (avoiding using OnAfterFetch in my block). 

Thanks

Hi,

Notice the following release notes today for Platform Server 10.0.900.0

https://success.outsystems.com/Support/Release_Notes/Platform_Server/Platform_Server_10.0.900.0

with the following fix:

  • Fixed an issue that caused triggering On After Fetch events in disposed Screens of the mobile apps. The logs of the affected application had ControllerDisposedException error. (RPD-3216)

Not 100% sure, but I think this a fix for the problem mentioned in this thread.

Regards,

Daniel