[Hi Loading for Splash Screen] On Destroy Event doesn't destroy VS OnComplete doesn't run
Question
Forge component by Hi Interactive

Hi all,


After leaving the Login page, the On progress and the OnComplete event still get triggered.


Let me explain our use case of the component:

1. we use your component to have a nice loading page while logging in into the app (GetUserData data action is an API to log in the user with JWT Token).

2. we have an after Fetch Event to set some client variables and redirect the user to a specific page:

3. We are not using the handlers of the OnComplete or OnUpgrade


but errors raised regarding the trigger of the OnUpgrade and the OnComplete:

Invalid call of the 'TriggerOnUpgradeProgress' 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.

Invalid call of the 'TriggerOnLoadComplete' 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. 


I checked the component, and you have the On Destroy:


But your Ondestroy only clears the set timeout; on the OnInialize Event, you have a callback for the onProgress and OnComplete listening for the application lifecycle:

Should your OnDestroy Event destroy these callbacks too?


4. So, to avoid these JS errors I decided to start using the OnComplete Action. I changed the action from the On After Fetch to the handler of the OnComplete, and the OnDestroy errors disappeared:

However, after deploying the module, the OnComplete doesn't redirect the user to the specific screen.

It stays there without any change. This only happens on the first access to the application after the deploy.

It seems to me that OnComplete Handler is not running in this situation.


Have you ever experienced this behavior?


Cheers,

Luís

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