Skip to content

Commit

Permalink
Find rather than filter to select 1st element (#4569)
Browse files Browse the repository at this point in the history
  • Loading branch information
megrogan authored Oct 12, 2023
1 parent 0ce2b1f commit 5cde7e5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions frontend/app/src/components/home/Home.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,9 @@
(pathParams.kind === "selected_community_route" ||
pathParams.kind === "chat_list_route")
) {
const unarchived = $chatSummariesListStore.filter((c) => !c.membership.archived);
if (unarchived.length > 0) {
page.redirect(routeForChatIdentifier($chatListScope.kind, unarchived[0].id));
const first = $chatSummariesListStore.find((c) => !c.membership.archived);
if (first !== undefined) {
page.redirect(routeForChatIdentifier($chatListScope.kind, first.id));
return;
}
}
Expand Down

0 comments on commit 5cde7e5

Please sign in to comment.