Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support {:halt, render_with/2} in mount hook #2961

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Gazler
Copy link
Member

@Gazler Gazler commented Dec 22, 2023

Previously, it was only possible to {:halt, redirect} or {:cont, socket} in a mount hook. This commit adds the ability to use halt if render_with has been specified.

When both render_with and redirect are specified, an ArgumentError is raised, as it is ambigious which should be used.


{:halt, %Socket{private: %{render_with: render_with}} = socket}
when is_function(render_with) ->
{:halt, put_private(socket, :halted, true)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation wise, it would be best if we didn't have to look into both private/redirected. If we could unify in a single place, it would be better.

@Gazler Gazler force-pushed the gr-halt-execution-on-render-with branch from 5c69684 to 44ec6b8 Compare January 18, 2024 16:00
Previously, it was only possible to `{:halt, redirect}` or `{:cont,
socket}` in a mount hook. This commit adds the ability to use halt if
render_with has been specified.

When both render_with and redirect are specified, an ArgumentError is
raised, as it is ambigious which should be used.
@Gazler Gazler force-pushed the gr-halt-execution-on-render-with branch from 44ec6b8 to 7f2ee49 Compare January 18, 2024 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants