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

Replace phx-feedback-for in favor of used_input?/1 #5713

Merged
merged 6 commits into from
May 3, 2024
Merged

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)))
Copy link
Member

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?

Copy link
Member

@josevalim josevalim left a 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!

@chrismccord chrismccord changed the title Replace phx-feedback-for in favor of used_errors Replace phx-feedback-for in favor of used_input?/1 Feb 6, 2024
Comment on lines 81 to 82
defp assign_form(socket, %Ecto.Changeset{} = changeset, action) do
assign(socket, :form, to_form(changeset, action: action))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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))

@chrismccord chrismccord merged commit ed19338 into main May 3, 2024
4 of 12 checks passed
@chrismccord chrismccord deleted the cm-used-errors branch May 3, 2024 17:20
SteffenDE added a commit that referenced this pull request Jun 17, 2024
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.

2 participants