Scroll problems with Flow Router


#1

I have an App that has different pages, so I use Flow Router to route and render templates. The problem is, when I scroll in the homepage of my app, the same scroll is saved across different pages, but I need to start from the top of that pages. I tried with a triggersEnd:

FlowRouter.route('/profile/:_id', {
  triggersEnter: [() => {
    window.scrollTo(0, 0);
  }],
  action() {
    BlazeLayout.render('App_body', { main: 'memory' });
  }
});

The code works, the route (profile) now display from the top, but when I return to my homepage I have to scroll from the top again, the previous scroll is not saved. I suppose is because the window.scrollTo(0, 0); is the last scroll saved. Is there a way to save the homepage scroll and then use it in a triggersExit? Or maybe another kind of approach.

Any help would be great, thanks.