You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed a race condition related to the flash. Basically the redirect can complete before the flash is saved to the database - meaning that the flash doesn't show till the next page load (an unfortunate bug for a flash).
I'm unsure if I'm the only one to experience this from hackathon-starter, as I'm using another db rather than the default mongo/mongoose. In theory, it can happen anytime you call (and execute) the redirect, before the session is done saving - and all the redirects in this repo currently don't wait for the session to be saved.
I can send a PR to save the session before redirecting, like this:
req.session.save(function(){res.redirect('/login');}// Some more code needs to be rewritten in the controllers/user.js so the various functions don't fall through
Before I do, I thought I'd check to see if this has been an issue for others. If not, feel free to close this issue.
The text was updated successfully, but these errors were encountered:
nemild
changed the title
Session
Session Flash race condition
Feb 12, 2016
@nemild I am going to close this issue for now since this has never been a problem for me with flash messages. There haven't been any reports of this issue either; until now. In my latest project I am not even using flash messages anymore, but instead render the same page with additional data:
Thanks for all the hard work on this!
I noticed a race condition related to the flash. Basically the redirect can complete before the flash is saved to the database - meaning that the flash doesn't show till the next page load (an unfortunate bug for a flash).
I'm unsure if I'm the only one to experience this from hackathon-starter, as I'm using another db rather than the default mongo/mongoose. In theory, it can happen anytime you call (and execute) the redirect, before the session is done saving - and all the redirects in this repo currently don't wait for the session to be saved.
I can send a PR to save the session before redirecting, like this:
Before I do, I thought I'd check to see if this has been an issue for others. If not, feel free to close this issue.
The text was updated successfully, but these errors were encountered: