page.pageFrom not showing the correct page

in my page event im checking the previous page name using page.pageFrom

$$(document).on('page:afterin', '.page[data-name="StoreList"]', function (e, page) {

    console.log(; => this show "Store" even if i was not coming from "Store" page.

    if ( != "Store") {

this happen if i use the back button multiple times then accessed the page with the attached event.

all my pages are stacked.

pageFrom’s data can be not really reliable as it can be affected by some aspects if you use stack pages or keepAlive. It is better to rely on router routeChange and routeChanged events

1 Like

But it would be nice to allow the cache to work across pages but different DOM instances for each route.

So for example /report/:id should keep alive such that report/1 and report/2 are both cached with its own state, DOM page. So when I switch between them, they are already there and don’t lose the “filters” I previously did in id=1 because I’m just switching routes,