From 00a289fb3e8edfb56002a9428f8a783bfb38e0c0 Mon Sep 17 00:00:00 2001 From: LocalNewsTV <62873746+LocalNewsTV@users.noreply.github.com> Date: Tue, 26 Nov 2024 16:18:22 -0800 Subject: [PATCH] reduce if to use optional chain --- app/src/utils/filterRecordsetsByNetworkState.ts | 5 ++--- app/src/utils/record-cache/sqlite-cache.ts | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/utils/filterRecordsetsByNetworkState.ts b/app/src/utils/filterRecordsetsByNetworkState.ts index 8adcf349f..94dfb070d 100644 --- a/app/src/utils/filterRecordsetsByNetworkState.ts +++ b/app/src/utils/filterRecordsetsByNetworkState.ts @@ -6,10 +6,9 @@ import { UserRecordCacheStatus, UserRecordSet } from 'interfaces/UserRecordSet'; * @param userOffline Current Network state of user, * @returns Users accessible recordsets */ -const filterRecordsetsByNetworkState = (recordSets: Record, userOffline: boolean): string[] => { - return Object.keys(recordSets).filter((set) => { +const filterRecordsetsByNetworkState = (recordSets: Record, userOffline: boolean): string[] => + Object.keys(recordSets).filter((set) => { return recordSets[set].cacheMetadata.status === UserRecordCacheStatus.CACHED || !userOffline; }); -}; export default filterRecordsetsByNetworkState; diff --git a/app/src/utils/record-cache/sqlite-cache.ts b/app/src/utils/record-cache/sqlite-cache.ts index 45b70d397..afd13506e 100644 --- a/app/src/utils/record-cache/sqlite-cache.ts +++ b/app/src/utils/record-cache/sqlite-cache.ts @@ -131,7 +131,7 @@ class SQLiteRecordCacheService extends RecordCacheService { [...recordSetIdList, startPos, limit] ); - if (!results || !results.values || results?.values?.length === 0) { + if (!results?.values || results.values?.length === 0) { return []; }