fix(plugin): repeat registration key to plugin ui items

This commit is contained in:
charlie
2022-06-16 13:28:11 +08:00
committed by Tienson Qin
parent fe1419a4d2
commit 5b14b6f50f
2 changed files with 6 additions and 4 deletions

View File

@@ -317,11 +317,13 @@
(swap! state/state medley/dissoc-in [:plugin/simple-commands (keyword pid)]))
(defn register-plugin-ui-item
[pid {:keys [type] :as opts}]
[pid {:keys [key type] :as opts}]
(when-let [pid (keyword pid)]
(when (contains? (:plugin/installed-plugins @state/state) pid)
(swap! state/state update-in [:plugin/installed-ui-items pid]
(fnil conj []) [type opts pid])
(let [items (or (get-in @state/state [:plugin/installed-ui-items pid]) [])
items (filter #(not= key (:key (second %))) items)]
(swap! state/state assoc-in [:plugin/installed-ui-items pid]
(conj items [type opts pid])))
true)))
(defn unregister-plugin-ui-items