Skip to content

Commit

Permalink
Clear new identity from search
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferossgp committed Jul 27, 2020
1 parent b84e37a commit 9209083
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/status_im/ui/screens/add_new/new_chat/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@
new-identity
@resolve-last-id])}})))))))

(handlers/register-handler-fx
::new-chat-focus
(fn [{:keys [db]}]
{:db (dissoc db :contacts/new-identity)}))
(fx/defn clear-new-identity
{:events [::clear-new-identity ::new-chat-focus]}
[{:keys [db]}]
{:db (dissoc db :contacts/new-identity)})

(defn- get-validation-label [value]
(case value
Expand Down
7 changes: 5 additions & 2 deletions src/status_im/ui/screens/home/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
[status-im.ui.components.colors :as colors]
[status-im.ui.screens.add-new.new-public-chat.view :as new-public-chat]
[quo.core :as quo]
[status-im.ui.screens.add-new.new-chat.events :as new-chat]
[status-im.ui.components.search-input.view :as search-input]
[status-im.ui.screens.add-new.new-public-chat.db :as db]
[status-im.utils.debounce :as debounce]
Expand Down Expand Up @@ -94,10 +95,12 @@
:search-filter search-filter
:on-cancel #(re-frame/dispatch [:search/home-filter-changed nil])
:on-blur #(when-not (seq chats)
(re-frame/dispatch [:search/home-filter-changed nil]))
(re-frame/dispatch [:search/home-filter-changed nil])
(re-frame/dispatch [::new-chat/clear-new-identity]))
:on-focus (fn [search-filter]
(when-not search-filter
(re-frame/dispatch [:search/home-filter-changed ""])))
(re-frame/dispatch [:search/home-filter-changed ""])
(re-frame/dispatch [::new-chat/clear-new-identity])))
:on-change (fn [text]
(re-frame/dispatch [:search/home-filter-changed text])
(when-not (seq chats)
Expand Down

0 comments on commit 9209083

Please sign in to comment.