fix: make sure a convo exists before returning it in search results

There is an edge case if you are in the search results page, and delete
(or get a convo deleted from the network).
The corresponding convo does not exist anymore but the search result
selector still tries to extract values from it.

This commit fixes that issue by returning early if the corresponding
convo is not there anymore
pull/2326/head
Audric Ackermann 3 years ago
parent 45328dee33
commit bfda4c7c01
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -25,6 +25,11 @@ export const getSearchResults = createSelector(
searchState.contactsAndGroups.map(id => {
const value = lookup[id];
// on some edges cases, we have an id but no corresponding convo because it matches a query but the conversation was removed.
if (!value) {
return null;
}
// Don't return anything when activeAt is unset (i.e. no current conversations with this user)
if (value.activeAt === undefined || value.activeAt === 0) {
//activeAt can be 0 when linking device

Loading…
Cancel
Save