diff --git a/src/components/ImportOnyxState/index.native.tsx b/src/components/ImportOnyxState/index.native.tsx index d1781425ec3d..43d3742a3411 100644 --- a/src/components/ImportOnyxState/index.native.tsx +++ b/src/components/ImportOnyxState/index.native.tsx @@ -34,7 +34,6 @@ export default function ImportOnyxState({setIsLoading}: ImportOnyxStateProps) { } rollbackOngoingRequest(); - setIsLoading(true); readOnyxFile(file.uri) .then((fileContent: string) => { diff --git a/src/components/ImportOnyxState/index.tsx b/src/components/ImportOnyxState/index.tsx index 13a837a2c885..39b8b46a9ed1 100644 --- a/src/components/ImportOnyxState/index.tsx +++ b/src/components/ImportOnyxState/index.tsx @@ -3,6 +3,7 @@ import {useOnyx} from 'react-native-onyx'; import type {FileObject} from '@components/AttachmentModal'; import {setIsUsingImportedState, setPreservedUserSession} from '@libs/actions/App'; import {setShouldForceOffline} from '@libs/actions/Network'; +import {rollbackOngoingRequest} from '@libs/actions/PersistedRequests'; import Navigation from '@libs/Navigation/Navigation'; import type {OnyxValues} from '@src/ONYXKEYS'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -20,6 +21,7 @@ export default function ImportOnyxState({setIsLoading}: ImportOnyxStateProps) { return; } + rollbackOngoingRequest(); setIsLoading(true); const blob = new Blob([file as BlobPart]); diff --git a/src/libs/actions/PersistedRequests.ts b/src/libs/actions/PersistedRequests.ts index d8dcbe4ed3ee..c4df73067659 100644 --- a/src/libs/actions/PersistedRequests.ts +++ b/src/libs/actions/PersistedRequests.ts @@ -15,6 +15,7 @@ Onyx.connect({ if (ongoingRequest && persistedRequests.length > 0) { const nextRequestToProcess = persistedRequests.at(0); + // We try to remove the next request from the persistedRequests if it is the same as ongoingRequest // so we don't process it twice. if (isEqual(nextRequestToProcess, ongoingRequest)) {