Potential gotcha in setSession/setCreds functions in Yesod

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

You're absolutely correct, I had intended to put that comment in. It
will be in the docs for 0.6.
Michael
On Wed, Oct 20, 2010 at 6:05 PM, Max Cantor
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
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
participants (2)
-
Max Cantor
-
Michael Snoyman