Skip to content

Commit

Permalink
Use cloneDeep
Browse files Browse the repository at this point in the history
  • Loading branch information
mountiny committed Jan 10, 2025
1 parent 15f0b50 commit 15dc1c4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/libs/actions/PersistedRequests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import isEqual from 'lodash/isEqual';

Check failure on line 1 in src/libs/actions/PersistedRequests.ts

View workflow job for this annotation

GitHub Actions / ESLint check

Replace `isEqual·from·'lodash/isEqual` with `cloneDeep·from·'lodash/cloneDeep`

Check failure on line 1 in src/libs/actions/PersistedRequests.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Replace `isEqual·from·'lodash/isEqual` with `cloneDeep·from·'lodash/cloneDeep`
import cloneDeep from 'lodash/cloneDeep';

Check failure on line 2 in src/libs/actions/PersistedRequests.ts

View workflow job for this annotation

GitHub Actions / ESLint check

Replace `cloneDeep·from·'lodash/cloneDeep` with `isEqual·from·'lodash/isEqual`

Check failure on line 2 in src/libs/actions/PersistedRequests.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Replace `cloneDeep·from·'lodash/cloneDeep` with `isEqual·from·'lodash/isEqual`
import Onyx from 'react-native-onyx';
import Log from '@libs/Log';
import ONYXKEYS from '@src/ONYXKEYS';
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 15dc1c4

Please sign in to comment.