Skip to content

Commit

Permalink
delete last selection when clear button is clicked
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmarcon committed Jun 19, 2024
1 parent a1c85fb commit b7261b3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/live_select/component.ex
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,12 @@ defmodule LiveSelect.Component do

@impl true
def handle_event("clear", _params, socket) do
{:noreply, clear(socket, %{input_event: true})}
socket =
socket
|> assign(last_selection: nil)
|> clear(%{input_event: true})

{:noreply, socket}
end

@impl true
Expand Down

0 comments on commit b7261b3

Please sign in to comment.