From 913295476a37024b8df855c1431aa398158f0391 Mon Sep 17 00:00:00 2001
From: Blazej Kustra
Promise
Insert API responses and lifecycle data into Onyx
When set these keys will not be persisted to storage
-Initialize the store with actions and listening for storage events
Array
| An array of objects with shape {onyxMethod: oneOf('set', 'merge', 'mergeCollection', 'multiSet', 'clear'), key: string, value: *} |
-
-
-## setMemoryOnlyKeys(keyList)
-When set these keys will not be persisted to storage
-
-**Kind**: global function
-
-| Param | Type |
-| --- | --- |
-| keyList | Array.<string>
|
-
## init([options])
diff --git a/lib/Onyx.d.ts b/lib/Onyx.d.ts
index 8bf30964..3ab35031 100644
--- a/lib/Onyx.d.ts
+++ b/lib/Onyx.d.ts
@@ -304,11 +304,6 @@ declare function init(config?: InitOptions): void;
*/
declare function hasPendingMergeForKey(key: OnyxKey): boolean;
-/**
- * When set these keys will not be persisted to storage
- */
-declare function setMemoryOnlyKeys(keyList: OnyxKey[]): void;
-
/**
* Tries to get a value from the cache. If the value is not present in cache it will return the default value or undefined.
* If the requested key is a collection, it will return an object with all the collection members.
@@ -335,7 +330,6 @@ declare const Onyx: {
removeFromEvictionBlockList: typeof removeFromEvictionBlockList;
isSafeEvictionKey: typeof isSafeEvictionKey;
METHOD: typeof METHOD;
- setMemoryOnlyKeys: typeof setMemoryOnlyKeys;
tryGetCachedValue: typeof tryGetCachedValue;
isCollectionKey: typeof isCollectionKey;
isCollectionMemberKey: typeof isCollectionMemberKey;
diff --git a/lib/Onyx.js b/lib/Onyx.js
index 4a1f12c9..eb2a46fa 100644
--- a/lib/Onyx.js
+++ b/lib/Onyx.js
@@ -1588,17 +1588,6 @@ function update(data) {
return clearPromise.then(() => Promise.all(_.map(promises, (p) => p())));
}
-/**
- * When set these keys will not be persisted to storage
- * @param {string[]} keyList
- */
-function setMemoryOnlyKeys(keyList) {
- Storage.setMemoryOnlyKeys(keyList);
-
- // When in memory only mode for certain keys we do not want to ever drop items from the cache as the user will have no way to recover them again via storage.
- cache.setRecentKeysLimit(Infinity);
-}
-
/**
* Initialize the store with actions and listening for storage events
*
@@ -1681,7 +1670,6 @@ const Onyx = {
removeFromEvictionBlockList,
isSafeEvictionKey,
METHOD,
- setMemoryOnlyKeys,
tryGetCachedValue,
hasPendingMergeForKey,
isCollectionKey,
diff --git a/lib/storage/__mocks__/index.ts b/lib/storage/__mocks__/index.ts
index 3e6f156b..ba2ce0b6 100644
--- a/lib/storage/__mocks__/index.ts
+++ b/lib/storage/__mocks__/index.ts
@@ -65,8 +65,6 @@ const idbKeyvalMock: StorageProvider = {
getDatabaseSize() {
return Promise.resolve({bytesRemaining: 0, bytesUsed: 99999});
},
- // eslint-disable-next-line @typescript-eslint/no-empty-function
- setMemoryOnlyKeys() {},
};
const idbKeyvalMockSpy = {
@@ -86,7 +84,6 @@ const idbKeyvalMockSpy = {
storageMapInternal = data;
}),
getDatabaseSize: jest.fn(idbKeyvalMock.getDatabaseSize),
- setMemoryOnlyKeys: jest.fn(idbKeyvalMock.setMemoryOnlyKeys),
};
export default idbKeyvalMockSpy;
diff --git a/lib/storage/providers/IDBKeyVal.ts b/lib/storage/providers/IDBKeyVal.ts
index bc429bc2..cd9d3ba3 100644
--- a/lib/storage/providers/IDBKeyVal.ts
+++ b/lib/storage/providers/IDBKeyVal.ts
@@ -39,8 +39,6 @@ const provider: StorageProvider = {
},
multiSet: (pairs) => setMany(pairs, getCustomStore()),
clear: () => clear(getCustomStore()),
- // eslint-disable-next-line @typescript-eslint/no-empty-function
- setMemoryOnlyKeys: () => {},
getAllKeys: () => keys(getCustomStore()),
getItem: (key) =>
get(key, getCustomStore())
diff --git a/lib/storage/providers/SQLiteStorage.ts b/lib/storage/providers/SQLiteStorage.ts
index 6011277b..36eb3622 100644
--- a/lib/storage/providers/SQLiteStorage.ts
+++ b/lib/storage/providers/SQLiteStorage.ts
@@ -93,9 +93,6 @@ const provider: StorageProvider = {
});
},
- // eslint-disable-next-line @typescript-eslint/no-empty-function
- setMemoryOnlyKeys: () => {},
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
keepInstancesSync: () => {},
};
diff --git a/lib/storage/providers/types.ts b/lib/storage/providers/types.ts
index 3f811372..34e85116 100644
--- a/lib/storage/providers/types.ts
+++ b/lib/storage/providers/types.ts
@@ -61,11 +61,6 @@ type StorageProvider = {
*/
clear: () => Promise