rdkcentral / Lightning-SDK

SDK for Lightning framework
Apache License 2.0
130 stars 69 forks source link

Router: Support keepAlive for multiple instances of the same dynamic route #414

Open ChrisArasin opened 5 months ago

ChrisArasin commented 5 months ago

I have a show/entity page that links to related shows. They both use the dynamic route entity/:entityId. I want to preserve the scrolled position on the first show page when when clicking through to the second show page and then back pressing to the original page by using keepAlive.

However, the Router does not seem to allow preserving multiple instances of the same route, as cleanup is forced if the same route template is detected.

https://github.com/rdkcentral/Lightning-SDK/blob/092fe4bf359a8dd76a170ceda29bce77bf0092c6/src/Router/utils/router.js#L411-L414

sandeep-vedam commented 5 months ago

Hi @ChrisArasin

We are investigating this issue. Just wanted to know whether you have used any other Router parameters in the app.

ChrisArasin commented 5 months ago

@sandeep-vedam What do you mean exactly? I have other routes that are also dynamic if that's the question.

sandeep-vedam commented 5 months ago

Hey @ChrisArasin I mean any of the Router settings mentioned in the below link https://lightningjs.io/docs/#/lightning-sdk-reference/plugins/router/settings

ChrisArasin commented 5 months ago

At the moment we have this configuration:

  router: {
    lazyCreate: true,
    lazyDestroy: true,
    gcOnUnload: true,
    reuseInstance: false,
    destroyOnHistoryBack: true,
  },