Skip to content

Commit

Permalink
reduce if to use optional chain
Browse files Browse the repository at this point in the history
  • Loading branch information
LocalNewsTV authored and plasticviking committed Nov 27, 2024
1 parent ff12332 commit 00a289f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions app/src/utils/filterRecordsetsByNetworkState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, UserRecordSet>, userOffline: boolean): string[] => {
return Object.keys(recordSets).filter((set) => {
const filterRecordsetsByNetworkState = (recordSets: Record<string, UserRecordSet>, userOffline: boolean): string[] =>
Object.keys(recordSets).filter((set) => {
return recordSets[set].cacheMetadata.status === UserRecordCacheStatus.CACHED || !userOffline;
});
};

export default filterRecordsetsByNetworkState;
2 changes: 1 addition & 1 deletion app/src/utils/record-cache/sqlite-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 [];
}

Expand Down

0 comments on commit 00a289f

Please sign in to comment.