fix loading of chat's messages
This commit is contained in:
parent
277905124d
commit
8bda739201
|
@ -285,13 +285,15 @@
|
|||
|
||||
(defmethod nav/preload-data! :chat
|
||||
[{:keys [current-chat-id] :as db} [_ _ id]]
|
||||
(let [messages (get-in db [:chats current-chat-id :messages])]
|
||||
(let [chat-id (or id current-chat-id)
|
||||
messages (get-in db [:chats chat-id :messages])
|
||||
db' (assoc db :current-chat-id chat-id)]
|
||||
(println "wuuut..." chat-id messages)
|
||||
(if (seq messages)
|
||||
(-> db
|
||||
(assoc :current-chat-id (or id current-chat-id))
|
||||
db'
|
||||
(-> db'
|
||||
load-messages!
|
||||
init-chat)
|
||||
db)))
|
||||
init-chat))))
|
||||
|
||||
(defn prepare-chat
|
||||
[{:keys [contacts] :as db} [_ contcat-id]]
|
||||
|
|
|
@ -3,12 +3,10 @@
|
|||
(:require [re-frame.core :refer [register-sub]]))
|
||||
|
||||
(register-sub :selected-participant
|
||||
(fn [db [_]]
|
||||
(let [participants (:selected-participants @db)]
|
||||
(fn [db _]
|
||||
(reaction
|
||||
(when (seq participants)
|
||||
(let [identity (first participants)]
|
||||
(get-in @db [:contacts identity])))))))
|
||||
(let [identity (first (:selected-participants @db))]
|
||||
(get-in @db [:contacts identity])))))
|
||||
|
||||
(register-sub :group-settings
|
||||
(fn [db [_ k]]
|
||||
|
|
Loading…
Reference in New Issue