Flash messages not being rendered in scenarios like submitting the reset password form, telling the user that the request has been received.
The Reason
There are actually two reasons:
1) Our liveviews are rendering inside the root layout of the parent app, but the main layout (eg. live or app) was not being set.
A fresh generated Phoenix app has the flash messags within those layouts, and defines the layout to use when using the Phoenix.LiveView macro.
So now our liveviews do the same. Instead of using Phoenix.LiveView, with no layout configured, they use AshAuthentication.Phoenix.Web, which has a default layout configured which displays nice flash messages.
The Issue
Flash messages not being rendered in scenarios like submitting the reset password form, telling the user that the request has been received.
The Reason
There are actually two reasons:
1) Our liveviews are rendering inside the root layout of the parent app, but the main layout (eg.
live
orapp
) was not being set. A fresh generated Phoenix app has the flash messags within those layouts, and defines the layout to use when using the Phoenix.LiveView macro. So now our liveviews do the same. Instead of using Phoenix.LiveView, with no layout configured, they use AshAuthentication.Phoenix.Web, which has a default layout configured which displays nice flash messages.2) Flash messages were being set from live components, which do not propagate to their parent liveview for rendering. (I wrote a blog post on this a few months ago.).
The Result
With both of those issues fixed, now flash messages are rendered when appropriate:
https://github.com/team-alembic/ash_authentication_phoenix/assets/543859/5f6cd94a-f6c8-443d-bfe5-7b3e3ca8bbd0
Other Notes
If users have their own layout they want to use, it can be provided when defining routes, eg.
And it will be used instead of our default one. I feel like that should be documented somewhere, but I'm not sure exactly where.