-
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
Replace phx-feedback-for in favor of used_input?/1 #5713
Conversation
@@ -295,7 +295,7 @@ defmodule <%= @web_namespace %>.CoreComponents do | |||
def input(%{field: %Phoenix.HTML.FormField{} = field} = assigns) do | |||
assigns | |||
|> assign(field: nil, id: assigns.id || field.id) | |||
|> assign(:errors, Enum.map(field.errors, &translate_error(&1))) | |||
|> assign(:errors, Enum.map(Phoenix.Component.used_errors(field), &translate_error(&1))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my head we'd include used_errors
directly in CoreComponent. I don't think we have a precedent for helper input functions in Phoenix.Component, do we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better, just some tiny comments!
defp assign_form(socket, %Ecto.Changeset{} = changeset, action) do | ||
assign(socket, :form, to_form(changeset, action: action)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defp assign_form(socket, %Ecto.Changeset{} = changeset, action) do | |
assign(socket, :form, to_form(changeset, action: action)) | |
defp assign_form(socket, %Ecto.Changeset{} = changeset, opts \\ []) do | |
assign(socket, :form, to_form(changeset, opts)) |
This reverts commit ed19338.
Required releases of
phoenix_html
Add form action and consider input changed if action changes phoenix_html#439phoenix_ecto
Use to_form :action as changeset action when passed phoenix_ecto#171phoenix_live_view
Introduce tracking of used and unused inputs with error message filtering phoenix_live_view#3090