From 15dc1c4e084fbbaf09877e7c25f663e799948fc3 Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Fri, 10 Jan 2025 23:43:38 +0100 Subject: [PATCH 1/2] Use cloneDeep --- src/libs/actions/PersistedRequests.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/PersistedRequests.ts b/src/libs/actions/PersistedRequests.ts index c4df73067659..18e23cae6eb1 100644 --- a/src/libs/actions/PersistedRequests.ts +++ b/src/libs/actions/PersistedRequests.ts @@ -1,4 +1,5 @@ import isEqual from 'lodash/isEqual'; +import cloneDeep from 'lodash/cloneDeep'; import Onyx from 'react-native-onyx'; import Log from '@libs/Log'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -60,7 +61,7 @@ function endRequestAndRemoveFromQueue(requestToRemove: Request) { * We only remove the first matching request because the order of requests matters. * If we were to remove all matching requests, we can end up with a final state that is different than what the user intended. */ - const requests = [...persistedRequests]; + const requests = cloneDeep(persistedRequests); const index = requests.findIndex((persistedRequest) => isEqual(persistedRequest, requestToRemove)); if (index !== -1) { From 34f795d3b43a0062311b87921cb9828973430adc Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Fri, 10 Jan 2025 23:54:44 +0100 Subject: [PATCH 2/2] Prettier --- src/libs/actions/PersistedRequests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/PersistedRequests.ts b/src/libs/actions/PersistedRequests.ts index 18e23cae6eb1..894adf78f735 100644 --- a/src/libs/actions/PersistedRequests.ts +++ b/src/libs/actions/PersistedRequests.ts @@ -1,5 +1,5 @@ -import isEqual from 'lodash/isEqual'; import cloneDeep from 'lodash/cloneDeep'; +import isEqual from 'lodash/isEqual'; import Onyx from 'react-native-onyx'; import Log from '@libs/Log'; import ONYXKEYS from '@src/ONYXKEYS';