Keep the state up to date when changing props

props-settings-ui-keyboard-propagation
Adam Rutkowski 3 years ago
parent e63fb39d38
commit d8057bfd59

@ -136,21 +136,24 @@ defmodule PlausibleWeb.Live.PropsSettings do
add_prop?: false,
filter_text: "",
all_props: props,
displayed_props: props
displayed_props: props,
site: %{socket.assigns.site | allowed_event_props: props}
)
|> put_flash(:success, "Properties added successfully")
{:noreply, socket}
end
def handle_info({:prop_allowed, prop}, socket) when is_binary(prop) do
def handle_info({:prop_allowed, prop}, %{assigns: %{site: site}} = socket)
when is_binary(prop) do
socket =
socket
|> assign(
add_prop?: false,
filter_text: "",
all_props: [prop | socket.assigns.all_props],
displayed_props: [prop | socket.assigns.all_props]
displayed_props: [prop | socket.assigns.all_props],
site: %{site | allowed_event_props: [prop | site.allowed_event_props]}
)
|> put_flash(:success, "Property added successfully")

@ -143,7 +143,8 @@ defmodule PlausibleWeb.Live.PropsSettings.Form do
{:noreply,
assign(socket,
site: site,
form: new_form(site)
form: new_form(site),
prop_key_options_count: 0
)}
end

Loading…
Cancel
Save