Skip to content

Commit

Permalink
fix: ordering issue for dropdown events
Browse files Browse the repository at this point in the history
I was finding that it was happening in this order:
- :dropdown-selection
- :update-url
- :tx-batch/init

Now :update-url should always run last.
This might have been the actual bug I was trying to fix
  • Loading branch information
Akeboshiwind committed Jun 3, 2024
1 parent 90ea82d commit 260b333
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/cljs/xt_play/client.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
{:db (-> db
(assoc :type new-type)
(assoc :query (query/default new-type)))
:dispatch [::tx-batch/init [(tx-batch/default new-type)]]}))
:fx [[:dispatch [::tx-batch/init [(tx-batch/default new-type)]]]
[:dispatch [:update-url]]]}))

(rf/reg-event-db
:set-query
Expand Down Expand Up @@ -77,8 +78,7 @@
[dropdown {:items [{:value :sql :label "SQL"}
{:value :xtql :label "XTQL"}]
:selected @(rf/subscribe [:get-type])
:on-click #(rf/dispatch [:fx [[:dispatch [:dropdown-selection (:value %)]]
[:dispatch [:update-url]]]])
:on-click #(rf/dispatch [:dropdown-selection (:value %)])
:label (case @(rf/subscribe [:get-type])
:xtql "XTQL"
:sql "SQL")}])
Expand Down

0 comments on commit 260b333

Please sign in to comment.