From 60e6dd7822246bc8e1c902e6d825f71a14d39493 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 7 Dec 2020 16:45:18 +0100 Subject: [PATCH] :bug: Fixed count projects in dashboard when deleting file --- frontend/src/app/main/data/dashboard.cljs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/main/data/dashboard.cljs b/frontend/src/app/main/data/dashboard.cljs index 395503836f..10eba755d0 100644 --- a/frontend/src/app/main/data/dashboard.cljs +++ b/frontend/src/app/main/data/dashboard.cljs @@ -419,6 +419,8 @@ ;; --- Delete File (by id) +(declare delete-file-result) + (defn delete-file [{:keys [id project-id] :as params}] (us/assert ::file params) @@ -431,8 +433,18 @@ ptk/WatchEvent (watch [_ state s] - (->> (rp/mutation :delete-file {:id id}) - (rx/ignore))))) + (let [team-id (uuid/uuid (get-in state [:route :path-params :team-id]))] + (->> (rp/mutation :delete-file {:id id}) + (rx/map #(delete-file-result team-id project-id))))))) + +(defn delete-file-result + [team-id project-id] + + (ptk/reify ::delete-file + ptk/UpdateEvent + (update [_ state] + (-> state + (update-in [:projects team-id project-id :count] dec))))) ;; --- Rename File