Share session data across mounted routes#1351
Conversation
This looks like a great solution... also, I now learned how to test the session cookie. |
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
Kludex
left a comment
There was a problem hiding this comment.
Answering your comment above: in terms of styling, either the current or using the attribute you previously had, it's fine by me.
I would've used session_path as there's no concept of "session_root_path" yet, so we can choose the name. But whatever you prefer is fine. :)
|
Did you delete your comment? 🤔 |
|
@Kludex Yes 😅 I thought about an even more specific name, pushed it in a commit. Also I think we should use the attribute style, at least check on |
|
@florimondmanca Is there something else you'd want to check here? |
|
I think this is an okay change — as in, it does solve the use case. But the "special case" flavor of it still makes me think I'd like @tomchristie's opinion. Tom? 😄 |
|
Any updates? |
|
Thanks @florimondmanca! Going to close this off in favour of #1512. |
Fixes #1261
The resolution here builds on @devsetgo's idea:
Indeed, if we
Mount(routes=...), theroutesactually belong to the current app in the mount hierarchy, not to a fully separate app mounted on the sub-path, so session data on the current app should be shared with them.Note that we otherwise keep the "use root_path for (fully) sub-mounted apps" for #233.