Fixed an issue with uninstalling non-active extensions

Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
This commit is contained in:
Frederik Bolding 2018-11-24 14:01:04 +01:00 committed by Julien Eluard
parent 2d5c4e3892
commit 3c04982616
No known key found for this signature in database
GPG Key ID: 6FD7DB5437FCBEF6
1 changed files with 6 additions and 4 deletions

View File

@ -29,10 +29,12 @@
(update-hooks hooks/hook-in extension-key))))
(fx/defn remove-from-registry
[{:keys [db] :as cofx} extension-key]
(fx/merge cofx
(update-hooks hooks/unhook extension-key)
{:db (update-in db [:account/account :extensions] dissoc extension-key)}))
[cofx extension-key]
(let [extensions (get-in cofx [:db :account/account :extensions])]
(fx/merge cofx
(when (get-in extensions [extension-key :active?])
(update-hooks hooks/unhook extension-key))
{:db (update-in cofx [:db :account/account :extensions] dissoc extension-key)})))
(fx/defn change-state
[cofx extension-key active?]