In the the generated Phoenix CoreComponents
module there are flashes for client and server errors:
It looks like both are displayed based on the phx-disconnected
event. What causes one to be displayed vs the other?
In the the generated Phoenix CoreComponents
module there are flashes for client and server errors:
It looks like both are displayed based on the phx-disconnected
event. What causes one to be displayed vs the other?
On mobile now, sorry for being brief.
The key to the “trick” is in which CSS class in set on a parent container. Either phx-server-error
or phx-client-error
class is added, causing the selector to match. When no element is selected the calls to show
and hide
are no-ops.
Searching for those class names in Phoenix/LiveView will give you the full picture.
Because LiveView builds on top of Phoenix Channels, you will find some code is actually part of Phoenix instead of the LiveView repo as one could expect.
Thanks for the suggestion! Here is an example of where those classes get applied: