61
Views
6
Comments
[OfflineDetection] Add UnbindEvents to the OnDestroy of the OfflineDetectionEvents WebBlock
Question
offlinedetection
Mobile icon
Forge asset by darwinLabs Dev Team
Application Type
Mobile

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.

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

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?

2019-02-04 12-06-28
Rob Mooijman

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

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

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

2020-09-03 07-38-30
Frank Burm

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.

2022-02-18 15-32-27
João Almeida
Champion


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

2022-08-25 15-33-28
Tomás Silva Rocha

Hi all,

We have just released a new version of OfflineDetection where this fix is included.

Please note that this component's logic has been migrated to OfflineDetection Reactive, to allow it being used also by Reactive Web Apps, and it's likely to be discontinued in the future. For now is being kept for legacy and maintainability issues, but is strongly advised to switch to the new implementation. 

Therefore, when updating the version, please consider replacing the dependencies altogether.


Kind regards,

Tomás

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.