[web-devel] Potential gotcha in setSession/setCreds functions in Yesod

Max Cantor mxcantor at gmail.com
Wed Oct 20 18:05:42 CEST 2010


Maybe this is obvious to others, but it wasn't to me.  Any code that sets a cookie or session variable wont "take effect" until the next request.  Upon reflection, this should have been obvious to me because the session vars are read out of a Reader monad, but it wasnt..  

My point is that, you can't do something like:

setCreds False creds
m <- requireAuthId

in a single request.  The simple solution is to stick a redirect in there.  Not suggesting any code changes, but a simple note in the haddocks :)

Again, sry to bother if this should have been obvious too me.

Max



More information about the web-devel mailing list