Noah Settersten commited on
Commit ·
42d83b8
1
Parent(s): f0bcac3
chore: Make `search_term` input IDs unique
Browse filesThis resolves a browser console error:
`Multiple IDs detected: search_term. Ensure unique element ids.`
lib/medical_transcription_web/components/code_select.ex
CHANGED
|
@@ -11,7 +11,6 @@ defmodule MedicalTranscriptionWeb.Components.CodeSelect do
|
|
| 11 |
def mount(socket) do
|
| 12 |
socket =
|
| 13 |
socket
|
| 14 |
-
|> assign(:form, to_form(%{"search_term" => ""}))
|
| 15 |
|> assign(:codes, [])
|
| 16 |
|> assign(:selected_code, nil)
|
| 17 |
|> assign(:submitted_code_feedback, nil)
|
|
@@ -20,8 +19,15 @@ defmodule MedicalTranscriptionWeb.Components.CodeSelect do
|
|
| 20 |
end
|
| 21 |
|
| 22 |
@impl Phoenix.LiveComponent
|
| 23 |
-
def update(%{text: text} = _assigns, socket) do
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
end
|
| 26 |
|
| 27 |
@impl Phoenix.LiveComponent
|
|
|
|
| 11 |
def mount(socket) do
|
| 12 |
socket =
|
| 13 |
socket
|
|
|
|
| 14 |
|> assign(:codes, [])
|
| 15 |
|> assign(:selected_code, nil)
|
| 16 |
|> assign(:submitted_code_feedback, nil)
|
|
|
|
| 19 |
end
|
| 20 |
|
| 21 |
@impl Phoenix.LiveComponent
|
| 22 |
+
def update(%{id: id, text: text} = _assigns, socket) do
|
| 23 |
+
form = to_form(%{"search_term" => ""}, as: id)
|
| 24 |
+
|
| 25 |
+
socket =
|
| 26 |
+
socket
|
| 27 |
+
|> assign(:form, form)
|
| 28 |
+
|> assign(:text, text)
|
| 29 |
+
|
| 30 |
+
{:ok, socket}
|
| 31 |
end
|
| 32 |
|
| 33 |
@impl Phoenix.LiveComponent
|