From acccba6ed4ac8ba10c4a1269ebdcbdb51de6dbd5 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Tue, 28 Mar 2023 12:30:03 +0200 Subject: [PATCH] :bug: Fix invalid files amount after moving on dashboard --- CHANGES.md | 1 + frontend/src/app/main/data/dashboard.cljs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 0a8dad58e..796baf2ac 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -60,6 +60,7 @@ - Fix problem with text carring over next line when changing to fixed [Taiga #5067](https://tree.taiga.io/project/penpot/issue/5067) - Fix don't show invite user hero to users with editor role [Taiga #5086](https://tree.taiga.io/project/penpot/issue/5086) - Fix enter emails on onboarding new user creating team [Taiga #5089](https://tree.taiga.io/project/penpot/issue/5089) +- Fix invalid files amount after moving on dashboard [Taiga #5080](https://tree.taiga.io/project/penpot/issue/5080) ### :heart: Community contributions by (Thank you!) - To @ondrejkonec: for contributing to the code with: diff --git a/frontend/src/app/main/data/dashboard.cljs b/frontend/src/app/main/data/dashboard.cljs index 94d1ca7ac..0d812e4d2 100644 --- a/frontend/src/app/main/data/dashboard.cljs +++ b/frontend/src/app/main/data/dashboard.cljs @@ -925,6 +925,13 @@ {:num-files (count ids) :project-id project-id}) + ptk/UpdateEvent + (update [_ state] + (let [origin-project (get-in state [:dashboard-files (first ids) :project-id])] + (-> state + (update-in [:dashboard-projects origin-project :count] #(- % (count ids))) + (update-in [:dashboard-projects project-id :count] #(+ % (count ids)))))) + ptk/WatchEvent (watch [_ _ _] (let [{:keys [on-success on-error]