Router isNavigating check

Hello guys!

Our use case that we have multiple items in history stack. When we invoke Router.back() several times “immediately” that results in side effect: some pages were rendered over root route page and never detached. We have lazy destroy and creation enabled.

At this point we created an issue [Router] Page instances are not detached when navigating back · Issue #381 · rdkcentral/Lightning-SDK · GitHub.
But here mostly wondering - is it issue in fact or expected behavior? And we really need to check for isNavigating before introducing any kind of navigation.

Hi @alex.zamirouski ,

Are you programmatically calling back multiple times?
In that case maybe you could maintain the routes in a stack and just navigate to the intended path instead.

Or, is it common in your application to rapidly go back?
In that case maybe you could try adding some logic in _handleBack to count number of press and do the direct navigation thing I mention above.

Thank you for solutions provided!

Currently we are applying similar solutions calling Router plugin not directly but instead through the “proxy” which handles case mentioned above internally.

1 Like