-
Notifications
You must be signed in to change notification settings - Fork 3k
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
fix: Import Onyx state on iOS #53370
fix: Import Onyx state on iOS #53370
Conversation
@eVoloshchak Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-12-10.at.10.37.13.moviOS: NativeScreen.Recording.2024-12-10.at.10.18.10.mov |
return fileContent; | ||
}); | ||
}); | ||
return ReactNativeBlobUtil.fs.exists(filePath).then((exists) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TMisiukiewicz, have you considered using readStream instead of readFile?
According to the docs:
if the file is large, you should consider use readStream instead.
And since log files could realistically be large, we might hit a limit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this was my initial idea. However, when using it, the app was crashing immediately without any JS error. I found out during debugging with Xcode that this is the error that makes it crash:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
I couldn't find any information how to fix it. I found out that this was reported in the library repository here: RonRadtke/react-native-blob-util#392 but thought the fastest way to unblock me from doing other fixes related to Import is using readFile
. Works for me with ~15mb files. Maybe it's a good idea to go with this solution first and eventually adjust it once we hit any issues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's a good idea to go with this solution first and eventually adjust it once we hit any issues?
Can confirm, this works for large files on my end too. Agree, let's proceed with the current solution, we can follow-up in case any problems arise
A newly added PR checklist item requires us to have unit tests implemented for any new fix/feature
Is there a way a unit test could be implemented for this? |
@eVoloshchak yeah I was thinking about it when opening a PR, and in my opinion it's very difficult to write a good test here. The only thing we'd be able to do is mocking react-native-blob-util and testing if it calls the |
I'd say a good test overall for this whole import feature is that it just doesn't break the app - so the app should be tested with regular units in the first place, where needed (within the features). Import itself should only override load data from the file. Masking confidential pieces is already tested as part of the Export functionality. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/Gonals in version: 9.0.74-0 🚀
|
🚀 Deployed to production by https://github.com/luacmartins in version: 9.0.74-8 🚀
|
Explanation of Change
The library used for reading files in Import Onyx State is not maintained anymore, so we needed to change the way we read it. We replaced its usage with React Native Blob Util filesystem method.
Fixed Issues
$ #53060
PROPOSAL: #53060 (comment)
Tests
Should be tested on iOS and Android only.
Offline tests
n/a
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same as tests
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
android-import.mov
Android: mWeb Chrome
iOS: Native
ios.mp4
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop