Session and route changing

helloo everyone,happy new Year…

i need to understand cause meteor docs have no information about how/when session is deleted…

i implement infinite scrolling pub/sub…i use session to increase subscription limit… my default limit is 2…when user’s scroll reach bottom of window, this should increase 2 limit

first time visit the page,, let say myPage,, it shows 2 documents // as expected
typing Session.get("key") on console,, it prints 2 // as expected
when scroll reach bottom of window it added 2 documents // as expected
typing Session.get("key") on console,,, it prints 4 // as expected
when i change route (i use flowrouter),, and get back to myPage,, it shows 4 documents...
typing Session.get("key") on console, it print 2,, instead of 4

is this expected behavior…?? is this mean previous session has been deleted due to route changing…?? or, my mistake…?? as i googling, session variables do not survive a manual page refresh (cmd+r)… i don’t see page refresh when route is changing,

thank You so muchh,

router have nothing to do with Session

but when u said that you change route, how you do it? by clicking on some href ?

heloo @shock thanks for your response, yapp i click random link on myPage and get back to myPage by clicking it… i put myPage at header menu,

well, then it has nothing to do with router or so, just your code manipulating session.

ahhhh,

i have code like this:

Template.myPage.onCreated(function() {
  Session.set("docsLimit", 2);
  var self = this;
  self.autorun(function() {
    if (FlowRouter.getRouteName() === 'A') {
      Meteor.subscribe('A', Pi(), Session.get("docsLimit"));
    } else{
      Meteor.subscribe('B', Session.get("docsLimit"));
    };
  });
});

maybe,when i get back to myPage, the myPage template will re-create and Session.set("docsLimit", 2) will be called, then Session.get("docsLimit") will become 2, is this correct explanation…??

it could be, if you change the route to other layout or so.

okay then, i understand now… thank You so muchh,