From 9da7b47827044b1ccef9a9bb31c452fd9745ecc6 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Wed, 21 Dec 2022 20:42:45 +0200 Subject: [PATCH] Show the current channel when category is collapsed on tablets (#6888) --- app/queries/servers/system.ts | 8 +++++++- .../channel_list/categories_list/categories/body/index.ts | 2 -- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/queries/servers/system.ts b/app/queries/servers/system.ts index 2780a9e276..5306d7e1f2 100644 --- a/app/queries/servers/system.ts +++ b/app/queries/servers/system.ts @@ -404,7 +404,13 @@ export async function setCurrentTeamAndChannelId(operator: ServerDataOperator, t export const observeLastUnreadChannelId = (database: Database): Observable => { return querySystemValue(database, SYSTEM_IDENTIFIERS.LAST_UNREAD_CHANNEL_ID).observe().pipe( switchMap((result) => (result.length ? result[0].observe() : of$({value: ''}))), - switchMap((model) => of$(model.value)), + switchMap((model) => { + if (model.value) { + return of$(model.value); + } + + return observeCurrentChannelId(database); + }), ); }; diff --git a/app/screens/home/channel_list/categories_list/categories/body/index.ts b/app/screens/home/channel_list/categories_list/categories/body/index.ts index 4ec32b9a56..9182d24bb9 100644 --- a/app/screens/home/channel_list/categories_list/categories/body/index.ts +++ b/app/screens/home/channel_list/categories_list/categories/body/index.ts @@ -162,8 +162,6 @@ const enhance = withObservables(['category', 'isTablet', 'locale'], ({category, return { limit, sortedChannels, - notifyProps, - lastUnreadId, unreadsOnTop, unreadIds, category,