fix: table still shows deleted blocks

This commit is contained in:
Tienson Qin
2024-10-31 15:56:58 +08:00
parent beb8c46b21
commit 4da4f2b2d5
4 changed files with 47 additions and 21 deletions

View File

@@ -1297,6 +1297,15 @@ Similar to re-frame subscriptions"
(when (empty? (:sidebar/blocks @state))
(hide-right-sidebar!)))
(defn sidebar-remove-deleted-block!
[ids]
(let [ids-set (set ids)]
(update-state! :sidebar/blocks (fn [items]
(remove (fn [[repo id _]]
(and (= repo (get-current-repo)) (contains? ids-set id))) items)))
(when (empty? (:sidebar/blocks @state))
(hide-right-sidebar!))))
(defn sidebar-remove-rest!
[db-id]
(update-state! :sidebar/blocks (fn [blocks]