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
fix(live_view_hook): handle Bandit.TransportError and URI struct in connect_info (#1062)
* fix(live_view_hook): handle Bandit.TransportError and URI struct in connect_info
Wrap `get_connect_info/2` calls in `try/rescue` to gracefully handle
`Bandit.TransportError` when the WebSocket transport is already closed
during mount (fixes#1025).
Convert `socket.host_uri` to a string with `URI.to_string/1` before storing
it in request context, preventing JSON encoding failures when `:uri` is
not included in `connect_info` (fixes#1040).
Also sanitize non-JSON-encodable values in `:request` during event rendering
as defense-in-depth.
Co-Authored-By: OpenCode <noreply@opencode.ai>
* docs(live_view_hook): clarify connect_info requirements and rescue rationale
Expand the moduledoc to explain what each connect_info key provides
and that the hook still works when keys are omitted.
Add a comment to the try/rescue in get_connect_info_if_root/2 explaining
why we rescue broadly (Bandit is optional and we must never crash the
LiveView process).
Co-Authored-By: OpenCode <noreply@opencode.ai>
---------
Co-authored-by: OpenCode <noreply@opencode.ai>
0 commit comments