From 65941b3d420a0d919d3b0a6bf0f438fcc0e2f86a Mon Sep 17 00:00:00 2001 From: Miguel Ángel Moreno Date: Fri, 30 Dec 2022 22:47:42 +0100 Subject: fix(frontend): Move route navigation logic to effect --- src/frontend/tau/events.cljs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/frontend/tau/events.cljs') diff --git a/src/frontend/tau/events.cljs b/src/frontend/tau/events.cljs index e74d124..d6f9743 100644 --- a/src/frontend/tau/events.cljs +++ b/src/frontend/tau/events.cljs @@ -3,6 +3,7 @@ [day8.re-frame.http-fx] [re-frame.core :as rf] [reitit.frontend.easy :as rfe] + [reitit.frontend.controllers :as rfc] [tau.api :as api])) (rf/reg-event-db @@ -51,10 +52,13 @@ (rf/reg-event-fx ::navigated (fn [{:keys [db]} [_ new-match]] - {:db (-> db - (assoc :current-match new-match) - (assoc :show-pagination-loading false)) - ::scroll-to-top nil})) + (let [old-match (:current-match db) + controllers (rfc/apply-controllers (:controllers old-match) new-match) + match (assoc new-match :controllers controllers)] + {:db (-> db + (assoc :current-match match) + (assoc :show-pagination-loading false)) + ::scroll-to-top nil}))) (rf/reg-event-fx ::navigate -- cgit v1.2.3