-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Does not seem possible to use assign in custom error html #5726
Comments
@srcrip defmodule ExampleWeb.ErrorHTML do
use ExampleWeb, :html
def render("404.html" = template, assigns) do
message = "hello"
~H"""
<h1 class="text-2xl font-bold tracking-tight text-gray-900 sm:text-4xl">
<%= @status %> <%= message %>
</h1>
"""
end
end I know that you pasted just an example so maybe it doesn't fit what you need. But let me know. |
The error message is correct. This is not the render function of a LiveView nor of a component. We could relax it here and allow |
Not directly related to the issue, but check this comment. I guess this should be addressed once the component model is consolidated... IMHO, there's still some mental friction between how things used to be before (views/templates) vs after (components/templates) Phoenix 1.7. Since functional components were introduced, people expect functions that return HTML using |
We should set |
Environment
Actual behavior
If you try to use assign in a custom error html like this:
You get an error like:
Expected behavior
This should be a valid assigns so I think it should work?
The text was updated successfully, but these errors were encountered: