Don't report form control change on first render (#2852)

This commit is contained in:
Jonatan Kłosko 2024-11-08 07:24:19 +01:00 committed by GitHub
parent a8c08715e2
commit dd29be252b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,7 +3,7 @@ defmodule LivebookWeb.Output.ControlFormComponent do
@impl true @impl true
def mount(socket) do def mount(socket) do
{:ok, assign(socket, data: %{})} {:ok, assign(socket, data: nil)}
end end
@impl true @impl true
@ -17,7 +17,7 @@ defmodule LivebookWeb.Output.ControlFormComponent do
{field, assigns.input_views[input.id].value} {field, assigns.input_views[input.id].value}
end) end)
if data != prev_data do if prev_data != nil and data != prev_data do
change_data = change_data =
for {field, value} <- data, for {field, value} <- data,
assigns.control.attrs.report_changes[field], assigns.control.attrs.report_changes[field],