From 3c049826161ed0e429e34ec74dd81ef55828a770 Mon Sep 17 00:00:00 2001 From: Frederik Bolding Date: Sat, 24 Nov 2018 14:01:04 +0100 Subject: [PATCH] Fixed an issue with uninstalling non-active extensions Signed-off-by: Julien Eluard --- src/status_im/extensions/registry.cljs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/status_im/extensions/registry.cljs b/src/status_im/extensions/registry.cljs index fab3226061..e8e920c2f5 100644 --- a/src/status_im/extensions/registry.cljs +++ b/src/status_im/extensions/registry.cljs @@ -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?]