session icon indicating copy to clipboard operation
session copied to clipboard

Pass new session as extra param to Session reload and regenerate callbacks

Open sgpinkus opened this issue 3 years ago • 1 comments

Why? The scope calling regenerate (or reload) does not necessarily want or need to know what a req is. Passing the new session object as a callback parameter allows the callback to regenerate or resave then make changes without knowing about req. Example:

  session.regenerate((err, newSession) => {
    if(err) return next(err);
    session.justRegenerated = true;  // Just an example.
  });

I specifically wanted this to Session.regenerate but added to Session.reload too for consistency. Might also want it in Session.save callback but that seems to require change in the behaviour of plugins so I gave it a pass.

sgpinkus avatar Jul 29 '22 05:07 sgpinkus

@import-brain, @dougwilson Any chance merge?

sgpinkus avatar Nov 25 '22 19:11 sgpinkus