From 0702cd90cbe59801eb052a523c6025f69b9241ef Mon Sep 17 00:00:00 2001 From: Julian Kobrynski Date: Mon, 16 Feb 2026 14:06:39 +0100 Subject: [PATCH 1/2] remove RAM-only check from OnyxUtils remove function --- lib/OnyxUtils.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/OnyxUtils.ts b/lib/OnyxUtils.ts index 446e7bd2..fe27ddf5 100644 --- a/lib/OnyxUtils.ts +++ b/lib/OnyxUtils.ts @@ -899,10 +899,6 @@ function remove(key: TKey, isProcessingCollectionUpdate?: cache.drop(key); scheduleSubscriberUpdate(key, undefined as OnyxValue, undefined, isProcessingCollectionUpdate); - if (isRamOnlyKey(key)) { - return Promise.resolve(); - } - return Storage.removeItem(key).then(() => undefined); } From b778c4f7b1f6253592233e9afeaf64a3db3365fd Mon Sep 17 00:00:00 2001 From: Julian Kobrynski Date: Mon, 16 Feb 2026 14:20:23 +0100 Subject: [PATCH 2/2] add a unit test for the edited use case --- tests/unit/onyxUtilsTest.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/unit/onyxUtilsTest.ts b/tests/unit/onyxUtilsTest.ts index 3448c6ad..6a4cdb26 100644 --- a/tests/unit/onyxUtilsTest.ts +++ b/tests/unit/onyxUtilsTest.ts @@ -491,6 +491,22 @@ describe('OnyxUtils', () => { }); }); + describe('remove', () => { + it('should remove RAM-only key from storage when set to null', async () => { + const removeItemSpy = jest.spyOn(StorageMock, 'removeItem'); + + // First set the RAM-only key to a value + await Onyx.set(ONYXKEYS.RAM_ONLY_KEY, 'testValue'); + + removeItemSpy.mockClear(); + + // Setting null should trigger OnyxUtils.remove, which should also remove from storage + await Onyx.set(ONYXKEYS.RAM_ONLY_KEY, null); + + expect(removeItemSpy).toHaveBeenCalledWith(ONYXKEYS.RAM_ONLY_KEY); + }); + }); + describe('isRamOnlyKey', () => { it('should return true for RAM-only key', () => { expect(OnyxUtils.isRamOnlyKey(ONYXKEYS.RAM_ONLY_KEY)).toBeTruthy();