The documentation for Phoenix.LiveView.on_mount (Phoenix.LiveView — Phoenix LiveView v0.19.3) says:
Tip: if you need to define multiple
on_mount
callbacks, avoid defining multiple modules. Instead, pass a tuple and use pattern matching to handle different cases
What is the reason for this recommendation?
I am using the authentication code generated by phx.gen.auth
which defines a number of these callbacks in the MyAppWeb.UserAuth
module. I also have a couple of other callbacks that I use for audit logging. Should I follow this recommendation and move them all to a single new module?