Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve import onyx performance #56046

Merged
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
resolve comments
  • Loading branch information
kubabutkiewicz committed Jan 31, 2025
commit 4f5862f35ff89e46c948edbdb3f8853d4b799a51
1 change: 0 additions & 1 deletion src/components/ImportOnyxState/index.native.tsx
Original file line number Diff line number Diff line change
@@ -34,7 +34,6 @@ export default function ImportOnyxState({setIsLoading}: ImportOnyxStateProps) {
}

rollbackOngoingRequest();

setIsLoading(true);
readOnyxFile(file.uri)
.then((fileContent: string) => {
2 changes: 2 additions & 0 deletions src/components/ImportOnyxState/index.tsx
Original file line number Diff line number Diff line change
@@ -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]);
1 change: 1 addition & 0 deletions src/libs/actions/PersistedRequests.ts
Original file line number Diff line number Diff line change
@@ -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)) {