Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.
TypeScript analyticsanalytics-dashboardclickhouseelixirgoogle-analyticsmarketingopen-source-analyticsphoenixplausible-analyticspostgresqlprivacyprivacy-friendlyself-hostedsimple-analyticsstatisticstailwindcssweb-analyticswebsite-analyticswebsite-statswebsite-tracking
CombBox bugfix: stale spinner on creatable options selection (#3713)
hq136a8b3638217
diff --git a/lib/plausible_web/live/components/combo_box.ex b/lib/plausible_web/live/components/combo_box.exindex 4af94347fb..b0f12449c9 100644--- a/lib/plausible_web/live/components/combo_box.ex+++ b/lib/plausible_web/live/components/combo_box.ex@@ -243,7 +243,7 @@ defmodule PlausibleWeb.Live.Components.ComboBox do><ax-ref={"dropdown-#{@ref}-option-#{@idx}"}- x-on:click="selectionInProgress = true"+ x-on:click={not @creatable && "selectionInProgress = true"}phx-click={select_option(@ref, @submit_value, @display_value)}phx-value-submit-value={@submit_value}phx-value-display-value={@display_value}diff --git a/test/plausible_web/live/components/combo_box_test.exs b/test/plausible_web/live/components/combo_box_test.exsindex 33ca512434..156c920257 100644--- a/test/plausible_web/live/components/combo_box_test.exs+++ b/test/plausible_web/live/components/combo_box_test.exs@@ -274,6 +274,20 @@ defmodule PlausibleWeb.Live.Components.ComboBoxTest do"input[type=hidden][name=some_submit_name][value=\"my new option\"]")end++ test "selectionInProgress doesn't apply when no server roundtrip is needed", %{conn: conn} do+ {:ok, lv, html} = live_isolated(conn, CreatableView, session: %{})+ regular_option = find(html, "li#dropdown-test-creatable-component-option-1 a")++ assert Floki.attribute(regular_option, "x-on:click") == ["selectionInProgress = true"]++ creatable_option =+ lv+ |> type_into_combo("test-creatable-component", "my new option")+ |> find("input[type=hidden][name=some_submit_name][value=\"my new option\"]")++ assert Floki.attribute(creatable_option, "x-on:click") == []+ endenddescribe "async suggestions" do