Filter moved from view to the subscription

This commit is contained in:
Pawel Kapala 2021-10-13 00:46:20 +02:00 committed by Andrea Maria Piana
parent 483277d2bd
commit ff2590a40f
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
2 changed files with 9 additions and 8 deletions

View File

@ -1106,10 +1106,13 @@
; Don't show gaps if that's the case as we are still loading messages ; Don't show gaps if that's the case as we are still loading messages
(if (and (empty? message-list-seq) loading-messages?) (if (and (empty? message-list-seq) loading-messages?)
[] []
(->>
(-> message-list-seq (-> message-list-seq
(chat.db/add-datemarks) (chat.db/add-datemarks)
(hydrate-messages messages pin-messages) (hydrate-messages messages pin-messages)
(chat.db/collapse-gaps chat-id synced-from (datetime/timestamp) chat-type joined loading-messages?)))))) (chat.db/collapse-gaps chat-id synced-from (datetime/timestamp) chat-type joined loading-messages?))
;; remove when the issue with messages-view chat list-key-fn is fixed
(filter (fn [message] (some? (:message-id message)))))))))
(re-frame/reg-sub (re-frame/reg-sub
:chats/raw-chat-pin-messages-stream :chats/raw-chat-pin-messages-stream

View File

@ -306,9 +306,7 @@
(defn messages-view [{:keys [chat bottom-space pan-responder space-keeper show-input?]}] (defn messages-view [{:keys [chat bottom-space pan-responder space-keeper show-input?]}]
(let [{:keys [group-chat chat-id public? community-id admins]} chat (let [{:keys [group-chat chat-id public? community-id admins]} chat
messages (->> @(re-frame/subscribe [:chats/chat-messages-stream chat-id]) messages @(re-frame/subscribe [:chats/chat-messages-stream chat-id])]
;; remove when the issue with key-fn is fixed
(filter (fn [message] (some? (:message-id message)))))]
;;do not use anonymous functions for handlers ;;do not use anonymous functions for handlers
(when (seq messages) (when (seq messages)
[list/bidi-flat-list [list/bidi-flat-list