[OfflineDetection] Add UnbindEvents to the OnDestroy of the OfflineDetectionEvents WebBlock
Forge component by darwinLabs Dev Team
Published on 16 Feb 2018
Application Type

Dear team, while using your component I see a lot of errors stating: 

"Invalid call of the 'TriggerConfirmedOnline' client action of the 'Common.Login' 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.".

These kind of errors are mostly due to eventlisteners not being removed. I played a bit with this by adding the UnbindEvents JS from the OnInitlialize also to the OnDestroy of my consuming webblock. After doing that I had those errors no more. Could you add this in your component so it's not necessary to do this in the consumer?

Thanks for your reply.

Rank: #2

Hi Frank,

How could a component hook itself to the OnDestroys of a Screen? Would be swell if possible, but afaik currently the Platform doesn't allow this?

Rank: #54058

By binding an OnDestroy screenaction on it's own webblock OnDestroy event

Rank: #2

Ok, didn't know the component had a Block itself. Yes, in that case it should be added.

Rank: #735

Hello Kilian,

Thanks for your swift reply.

What I'm saying is that the component registers the event listeners (in the OnInitialize) and should also remove them in the OnDestroy.

I see Rob already explained as well.

Rank: #172

It was added to the backlog, we'll try to push an update soon.