Working out a weird issue with @snadon where session just wouldn't save. The flow that was being used was
- Land on page
- Make back-end API call
- Save data to session
- Refresh page
- Expect to see session data loaded, but no session was stored.
This was happening because in a default Lucky app, we disable cookies for the API
https://github.com/luckyframework/lucky_cli/blob/ca11a9fbe37b1130c9ab20c555509da66adab966/src/web_app_skeleton/src/actions/api_action.cr.ecr#L5
Now, what would be neat is if you have disable_cookies and then you call session.set if we could raise an error saying this won't work because cookies are disabled. A compile-time error would be best, but I don't think we'd be able to do that here, so just a runtime exception should be ok.
A few things to consider...
- What if you're not using cookie store for sessions?
- What if you have
disable_cookies for one action, but not another (as in you call session.set under an action that it's allowed...)?
Working out a weird issue with @snadon where session just wouldn't save. The flow that was being used was
This was happening because in a default Lucky app, we disable cookies for the API
https://github.com/luckyframework/lucky_cli/blob/ca11a9fbe37b1130c9ab20c555509da66adab966/src/web_app_skeleton/src/actions/api_action.cr.ecr#L5
Now, what would be neat is if you have
disable_cookiesand then you callsession.setif we could raise an error saying this won't work because cookies are disabled. A compile-time error would be best, but I don't think we'd be able to do that here, so just a runtime exception should be ok.A few things to consider...
disable_cookiesfor one action, but not another (as in you call session.set under an action that it's allowed...)?