       (commands/stage-command db command-info))))
 
 (register-handler :set-response-chat-command
+  (after update-response-suggestions-height!)
   (fn [db [_ to-msg-id command-key]]
-    (-> db
-        (commands/set-response-chat-command to-msg-id command-key)
-        (update-response-suggestions-height))))
+    (commands/set-response-chat-command db to-msg-id command-key)))
 
 (defn update-text
   [db [_ text]]

                                                   suggestions)))
          height (+ suggestions-height response-styles/request-info-height)
          anim-value (get-in db [:animations :response-suggestions-height])]
      (anim/stop-animation anim-value)
      (anim/start
        (anim/spring anim-value {:toValue    height
                                 :speed      10
                                 :bounciness 10}))))
  db)

(register-handler :set-chat-command-content
  (fn [{:keys [current-chat-id] :as db} [_ content]]
    (-> db
        (commands/set-chat-command-content content)
        (assoc-in [:chats current-chat-id :input-text] nil)
        (update-response-suggestions-height))))

(defn update-input-text
  [{:keys [current-chat-id] :as db} text]

        (assoc-in [:chats current-chat-id :command-input] {})
        (update-in [:chats current-chat-id :input-text] safe-trim))))

(defn animate-cancel-command! [db]
  (let [height-anim-value (get-in db [:animations :response-suggestions-height])
        to-value 1]
    (anim/add-listener height-anim-value
                       (fn [val]
                         (when (<= (- to-value delta) (anim/value val) (+ to-value delta))
                           (anim/remove-all-listeners height-anim-value)
                           (dispatch [:cancel-command]))))
    (anim/start (anim/spring height-anim-value {:toValue    to-value
                                                :speed      10
                                                :bounciness 1}))))

(register-handler :start-cancel-command
  (after animate-cancel-command!)
  (fn [db _]
    (let [current-chat-id (:current-chat-id db)
          hiding? (get-in db [:animations :response-input-is-hiding?])]
      (if-not hiding?
        (assoc-in db [:animations :response-input-is-hiding?] true)
        db))))

(defn update-response-suggestions-height! [db]
  (when (and (not (get-in db [:animations :response-input-is-hiding?]))
             (commands/get-chat-command-to-msg-id db))
    (let [command (commands/get-chat-command db)
