diff --git a/src/status_im/chat/models.cljs b/src/status_im/chat/models.cljs index b62137c45d..ddbefa4a85 100644 --- a/src/status_im/chat/models.cljs +++ b/src/status_im/chat/models.cljs @@ -265,6 +265,7 @@ [{db :db :as cofx} chat-id from-switcher?] (fx/merge cofx {:db (assoc db :current-chat-id chat-id)} + (offload-messages chat-id) (preload-chat-data chat-id) (navigation2/navigate-to-nav2 :chat chat-id nil from-switcher?))) @@ -496,4 +497,4 @@ (update-in [:chats chat-id :unviewed-messages-count] #(max (- % count) 0)) (update-in [:chats chat-id :unviewed-mentions-count] - #(max (- % countWithMentions) 0)))}) \ No newline at end of file + #(max (- % countWithMentions) 0)))}) diff --git a/src/status_im/chat/models_test.cljs b/src/status_im/chat/models_test.cljs index 6995ba7d0e..9857043e5c 100644 --- a/src/status_im/chat/models_test.cljs +++ b/src/status_im/chat/models_test.cljs @@ -84,3 +84,10 @@ :group-chat true} "opened" {} "1-1" {}}}) + +(deftest navigate-to-chat-nav2 + (let [chat-id "test_chat" + db {:pagination-info {chat-id {:all-loaded? true}}}] + (testing "Pagination info should be reset on navigation" + (let [res (chat/navigate-to-chat-nav2 {:db db} chat-id false)] + (is (nil? (get-in res [:db :pagination-info chat-id :all-loaded?])))))))