From 260b333ddf355908bf09e2eea57c27fe355fa6a5 Mon Sep 17 00:00:00 2001 From: Oliver Marshall Date: Mon, 3 Jun 2024 15:39:12 +0100 Subject: [PATCH] fix: ordering issue for dropdown events 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 --- src/cljs/xt_play/client.cljs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cljs/xt_play/client.cljs b/src/cljs/xt_play/client.cljs index 104a55c..e920792 100644 --- a/src/cljs/xt_play/client.cljs +++ b/src/cljs/xt_play/client.cljs @@ -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 @@ -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")}])