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
Browsers you attempted to reproduce this bug on (the more the merrier): Brave, Safari
Does the problem persist after removing "assets/node_modules" and trying again? Yes/no: yes
Actual behavior
An (external) redirect to a mailto link causes the LiveView to disconnect.
In my application I have a handle_event that handles a button click and redirects to a mailto link. After clicking the button, the LiveView is disconnected and I have to refresh the page.
thank you for reporting this and especially for including the single file script to reproduce!
LiveView assumes that calling redirect(socket, external: link) actually does a navigation and therefore blindly unloads the socket. This differs from the handling for links on the page, where we explicitly check if it's a special URL like mailto. I'm not sure yet if we really want to change this behavior, as there is a quite straightforward way to handle this without redirect:
This solves my problem, but I think the behavior should be changed, or the behavior should be addressed in the docs because mailto links are explicitly allowed in redirect/2, but cause an unexpected unload of the socket.
Environment
Actual behavior
An (external) redirect to a mailto link causes the LiveView to disconnect.
In my application I have a
handle_event
that handles a button click and redirects to amailto
link. After clicking the button, the LiveView is disconnected and I have to refresh the page.Here is an example of a single file that reproduces the problem: https://gist.github.com/Flo0807/900312c41b34188901bb22971cce5d18 (note that the + and - buttons no longer work after clicking the "Link" button)
Expected behavior
A redirect to a mailto link should not cause the LiveView to diconnect.
The text was updated successfully, but these errors were encountered: