How to prevent a single page from reloading while moving back?

I am creating a framework7 app while has following screens:-
1)home:- This is the main page of the app. The data is on this screen is actually populated from deviceready event.
2)search:- This is the search page. You can move from home screen to search screen.
3)detail:- From the search results, you can go to detail screen.

The problem is when i go back to main from detail after pressing back button two times. It actually resets the home screen. Since, its data is actually generated during deviceready event. I am unable to repopulate it in init event of home.

I tried stackPages, but they didn’t work. I want presistent behaviou on home screen only. Is there any way i can detect that user is coming to home after pressing back button or prevent the page from reloading while coming back.

2 Likes

Use pageInit event to load data together with stackPages: true.

Another way, you can check what is the previous page before loading data

$f7router.previousRoute.path === '/detail/ ? loadData() : doNothing()