68
Views
7
Comments
Invalid call of the 'OnDestroy' client action in Reactive Outsystems
Question
Application Type
Reactive
Invalid call of the 'OnDestroy' client action of the 'Allocation.ViewCustomerLevelAllocation' 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.


2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi,

What is your question?

-- Daniel

2024-10-12 12-11-20
Kerollos Adel
Champion

@Ajay Gupta  hallo , did you get this error when refresh dependance or upgrade can you please add more details 

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Most of the time you vet this error because the user navigates away from a screen or closes the app. If you have this error in the log, but your application works as expectes, you can ignore the error.

2024-01-23 06-57-30
Ajay Gupta

Hi @Daniël Kuhlmann yes  i am able to see this error in logs in Service center and yes my application works as expected.

As i was seeing this error frequently logged in service center i was curious to know what is this error and why it is getting logged so i posted this here.

I am not using any OnDestroy client action in my screen still it is getting logged in service center so i wanted to know if there is any workaround to avoid this error.

2024-09-12 07-55-10
Sana Shaikh

Hello,

If you have a code like this: 

setTimeout(function() {    $public.Actions.OnDestroy(); // This is incorrect}, 5000);

You should remove this call. Instead, use a global client action for any delayed logic. 

  • Ensure the OnDestroy event is only used as intended by the lifecycle.
  • Do not call OnDestroy manually or in setTimeout.
  • Use a global client action for logic that needs to execute independently.

Hope this helps.

2024-01-23 06-57-30
Ajay Gupta

Hi @Sana Shaikh I dont have any code related to timeout in my screen plus i am not using the screen OnDestroy event as well , still this error is logged in service center.

2025-04-08 13-09-23
Shubham Shrivastava

Hi Ajay,

This error occurs when the user navigates away from a screen. To fix this, you need to clear the interval in the onDestroy event. First, store the interval in a local variable during the onReady event, and then ensure it is cleared in the onDestroy event. I'm attaching the OML file for your reference. 



RefreshScreen.oml
Screenshot 2024-09-26 181058.png
Screenshot 2024-09-26 181202.png
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.