Skip to content

Commit

Permalink
cleanup part 3
Browse files Browse the repository at this point in the history
  • Loading branch information
kacper-mikolajczak committed Sep 30, 2024
1 parent a41bd1b commit 68c2702
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/useOnyx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import OnyxCache from './OnyxCache';
import type {Connection} from './OnyxConnectionManager';
import connectionManager from './OnyxConnectionManager';
import OnyxUtils from './OnyxUtils';
import type {CollectionKeyBase, KeyValueMapping, OnyxCollection, OnyxEntry, OnyxKey, OnyxValue} from './types';
import type {CollectionKeyBase, OnyxCollection, OnyxEntry, OnyxKey, OnyxValue} from './types';
import useLiveRef from './useLiveRef';
import usePrevious from './usePrevious';

Expand Down Expand Up @@ -61,7 +61,7 @@ type UseOnyxSelector<TKey extends OnyxKey, SelectorValue> = (data?: OnyxValue<TK

function getCachedValue<TKey extends OnyxKey>(key: TKey): OnyxValue<TKey> | undefined {
if (!OnyxUtils.isCollectionKey(key)) {
return OnyxCache.get(key) as OnyxValue<TKey>;
return OnyxCache.get(key);

Check failure on line 64 in lib/useOnyx.ts

View workflow job for this annotation

GitHub Actions / lint

Type 'unknown' is not assignable to type 'OnyxValue<TKey> | undefined'.
}

const allCacheKeys = OnyxCache.getAllKeys();
Expand All @@ -72,9 +72,9 @@ function getCachedValue<TKey extends OnyxKey>(key: TKey): OnyxValue<TKey> | unde
return;
}

const values: OnyxCollection<KeyValueMapping[TKey]> = {};
const values: Record<string, unknown> = {};
allCacheKeys.forEach((cacheKey) => {
if (!cacheKey.startsWith(key)) {
if (cacheKey.startsWith(key)) {
return;
}

Expand Down

0 comments on commit 68c2702

Please sign in to comment.