You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Elixir version (elixir -v): Elixir 1.19.3 (compiled with Erlang/OTP 26)
Phoenix version (mix deps): {:phoenix, "~> 1.8.6"}
Operating system: Mac M4
Actual behavior
Clipboard-20260506-011138-087.mp4
New projects are born with those flashes for connection issues and server crashes:
<.flashid="client-error"kind={:error}title={gettext("We can't find the internet")}phx-disconnected={show(".phx-client-error #client-error")|>JS.remove_attribute("hidden")}phx-connected={hide("#client-error")|>JS.set_attribute({"hidden",""})}hidden>...</.flash><.flashid="client-error"kind={:error}title={gettext("We can't find the internet")}phx-disconnected={show(".phx-client-error #client-error")|>JS.remove_attribute("hidden")}phx-connected={hide("#server-error")|>JS.set_attribute({"hidden",""})}hidden>...</flash>
When you trigger a client side error (say liveSocket.disconnect() both flash messages appear because |> JS.remove_attribute("hidden") is inside both phx-disconnected bindings so it doesnt respect whats in the main LiveView container just like show uses a match of selectors to show the correct error.
In that case I've added |> JS.remove_attribute("hidden", to: ".phx-XXXX-error #client-error") but Im happy to hear suggestions and Im also happy to contribute with a PR too :)
I've originally noticed this behavior by looking at https://comunidade.devsnorte.com/ when socket disconnected for real and went investigate. I didnt patch my website yet in case you want a live example.
Expected behavior
When the error is client side only, only display #client-error
Environment
{:phoenix, "~> 1.8.6"}Actual behavior
Clipboard-20260506-011138-087.mp4
New projects are born with those flashes for connection issues and server crashes:
When you trigger a client side error (say
liveSocket.disconnect()both flash messages appear because|> JS.remove_attribute("hidden")is inside bothphx-disconnectedbindings so it doesnt respect whats in the main LiveView container just likeshowuses a match of selectors to show the correct error.Ive reproduced in this repo and here's the commit with a simple fix: lubien/phoenix-bug-report-client-error-flash@f6fb4be
In that case I've added
|> JS.remove_attribute("hidden", to: ".phx-XXXX-error #client-error")but Im happy to hear suggestions and Im also happy to contribute with a PR too :)I've originally noticed this behavior by looking at https://comunidade.devsnorte.com/ when socket disconnected for real and went investigate. I didnt patch my website yet in case you want a live example.
Expected behavior
When the error is client side only, only display
#client-error