File tree 1 file changed +9
-3
lines changed
src/status_im/contexts/chat/messenger/composer/link_preview
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 38
38
(let [cache (get-in db [:chat/link-previews :cache ])
39
39
previews (urls->previews cache urls)
40
40
new-urls (->> previews
41
- (filter :loading? )
41
+ (filter (fn [{:keys [loading? status-link-preview?]}]
42
+ (or loading? status-link-preview?)))
42
43
(map :url ))
43
44
; ; `request-id` is a must because we need to process only the last
44
45
; ; unfurling event, as well as avoid needlessly updating the app db
139
140
sent."
140
141
{:events [:link-preview/reset-unfurled ]}
141
142
[{:keys [db]}]
142
- {:db (update db :chat/link-previews dissoc :unfurled :request-id :cleared )})
143
+ {:db (-> db
144
+ (update :chat/link-previews dissoc :unfurled :request-id :cleared )
145
+ (update :chat/status-link-previews dissoc :unfurled :request-id :cleared ))})
143
146
144
147
(rf/defn reset-all
145
148
" Reset all preview state. It is especially important to delete any cached
146
149
URLs, as failing to do so results in its unbounded growth."
147
150
{:events [:link-preview/reset-all ]}
148
151
[{:keys [db]}]
149
- {:db (dissoc db :chat/link-previews )})
152
+ {:db (-> db
153
+ (dissoc :chat/link-previews )
154
+ (dissoc :chat/status-link-previews ))})
150
155
151
156
(rf/defn clear-link-previews
152
157
" Mark current unfurled URLs as `cleared`, meaning the user won't see previews
156
161
(let [unfurled-urls (set (map :url (get-in db [:chat/link-previews :unfurled ])))]
157
162
{:db (-> db
158
163
(update :chat/link-previews dissoc :unfurled :request-id )
164
+ (update :chat/status-link-previews dissoc :unfurled :request-id )
159
165
(assoc-in [:chat/link-previews :cleared ] unfurled-urls))}))
You can’t perform that action at this time.
0 commit comments