-
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
[HOLD for payment 2023-09-29] [$500] Request money - Scan - Brief disappearance of "Attachment too small" modal text before modal closure #27274
Comments
ProposalPlease re-state the problem that we are trying to solve in this issue.Brief disappearance of "Attachment too small" modal text before modal closure What is the root cause of that problem?
App/src/pages/iou/ReceiptSelector/index.js Lines 143 to 151 in 662af46
App/src/pages/iou/ReceiptSelector/index.js Lines 65 to 67 in 662af46
App/src/libs/actions/Receipt.ts Line 18 in 662af46
App/src/components/Modal/BaseModal.js Line 189 in a365583
As a result, the attachmentInvalidReasonTitle, and attachmentInvalidReason are set to empty strings first, this makes the text disappear before the modal is completely closed. What changes do you think we should make in order to solve the problem?
function closeUploadReceiptModal() {
Onyx.merge(ONYXKEYS.RECEIPT_MODAL, {
isAttachmentInvalid: false,
});
}
App/src/pages/iou/ReceiptSelector/index.js Line 143 in 662af46
What alternative solutions did you explore? (Optional)
App/src/libs/actions/Receipt.ts Line 18 in 662af46
ResultScreen.Recording.2023-09-12.at.14.43.19.mov |
Triggered auto assignment to @kadiealexander ( |
Job added to Upwork: https://www.upwork.com/jobs/~01fc29b362e680f18d |
Bug0 Triage Checklist (Main S/O)
|
Triggered auto assignment to @NicMendonca ( |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @jjcoffee ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Brief disappearance of "Attachment too small" modal text before modal closure What is the root cause of that problem?The issue is coming from the ReceiptSelector component. The prop receiptModal coming from onyx is being reset to it's initial state before the modal gets closed. What changes do you think we should make in order to solve the problem?
const [showModal, setShowModal] = useState(false);
useEffect(() => {
if (isAttachmentInvalid) {
setShowModal(true);
}
}, [isAttachmentInvalid]);
const closeModal = () => {
setShowModal(false, () => {
Receipt.clearUploadReceiptError();
});
} <ConfirmModal
title={attachmentInvalidReasonTitle}
onConfirm={closeModal}
onCancel={closeModal}
isVisible={showModal}
prompt={attachmentInvalidReason}
confirmText={translate('common.close')}
shouldShowCancelButton={false}
/> Result receiptselector-1.mov |
📣 @oogushikun! 📣
|
|
|
2 similar comments
|
|
ProposalPlease re-state the problem that we are trying to solve in this issue.Request money - Scan - Brief disappearance of "Attachment too small" modal text before modal closure What is the root cause of that problem?We're storing the error states in Onyx, when dismissing the modal, we will see the texts disappeared then modal disappeared since we had 300ms for the animation. What changes do you think we should make in order to solve the problem?We're storing file validation in Onyx which makes it inconsistent with other places, and it also causes another issue when the page refreshed, error didn't clear. If we use local state we can resolve both issues.
const [isAttachmentInvalid, setIsAttachmentInvalid] = useState(false);
const [attachmentInvalidReasonTitle, setAttachmentInvalidReasonTitle] = useState('');
const [attachmentInvalidReason, setAttachmentInvalidReason] = useState('');
const validateReceipt = (file) => {
const {fileExtension} = FileUtils.splitExtensionFromFileName(lodashGet(file, 'name', ''));
if (_.contains(CONST.API_ATTACHMENT_VALIDATIONS.UNALLOWED_EXTENSIONS, fileExtension.toLowerCase())) {
setAttachmentInvalidReason('attachmentPicker.wrongFileType');
setAttachmentInvalidReasonTitle('attachmentPicker.notAllowedExtension');
return false;
}
if (lodashGet(file, 'size', 0) > CONST.API_ATTACHMENT_VALIDATIONS.MAX_SIZE) {
setAttachmentInvalidReason('attachmentPicker.wrongFileType');
setAttachmentInvalidReasonTitle('attachmentPicker.notAllowedExtension');
return false;
}
if (lodashGet(file, 'size', 0) < CONST.API_ATTACHMENT_VALIDATIONS.MIN_SIZE) {
setAttachmentInvalidReason('attachmentPicker.wrongFileType');
setAttachmentInvalidReasonTitle('attachmentPicker.notAllowedExtension');
return false;
}
return true;
}
if (!validateReceipt(file)) {
setIsAttachmentInvalid(true);
return;
}
onConfirm={() => setIsAttachmentInvalid(false)}
onCancel={() => setIsAttachmentInvalid(false)} What alternative solutions did you explore? (Optional)N/A ResultScreen.Recording.2023-09-13.at.14.06.22.mov |
@dukenv0307's proposal LGTM! The RCA is correct (the errors are set to empty strings before the modal hide animation completes), and the solution correctly addresses the RCA. With @oogushikun's proposal we already have a @hungvu193's proposal has an incorrect RCA as the issue doesn't come down to using Onyx (it might be true that we're not standardised on using Onyx for storing errors, but it's irrelevant to this issue). 🎀👀🎀 C+ reviewed |
Triggered auto assignment to @johnmlee101, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
Makes sense! |
@jjcoffee due to this reply, https://expensify.slack.com/archives/C01GTK53T8Q/p1695028441217399?thread_ts=1695028058.612099&cid=C01GTK53T8Q |
@dukenv0307 Are you able to use the gallery (bottom left) to attach an image to scan? |
@dukenv0307 So I've tested on iOS native by selecting a tiny PNG (<240 bytes) from the gallery, but no file size validation seems to run. I don't think that's related to your changes and think adding it would be OOS for this PR. Since there's no validation running, there's no need to test your changes as such, but it's good just to have a test of the flow anyway (so just uploading any image from the gallery). cc @johnmlee101 |
🎯 ⚡️ Woah @jjcoffee / @dukenv0307, great job pushing this forwards! ⚡️ The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉
On to the next one 🚀 |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.72-11 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2023-09-29. 🎊 After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.
For reference, here are some details about the assignees on this issue:
As a reminder, here are the bonuses/penalties that should be applied for any External issue:
|
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
Payouts due:
Eligible for 50% #urgency bonus? Yes Upwork job is here. |
@jjcoffee please complete the BugZero Checklist. @ayazhussain79 please accept the Upwork contract I sent across. |
@kadiealexander offer accepted, Thank you |
|
@kadiealexander Checklist complete! |
@johnmlee101, @jjcoffee, @kadiealexander, @dukenv0307 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
Everyone is paid! |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Action Performed:
Expected Result:
The "Attachment too small" modal text should remain visible without disappearance before the modal closes
Actual Result:
Brief disappearance of "Attachment too small" modal text before modal closure
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: v1.3.68-13
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
screen-recording-2023-09-09-at-124504-am-nrxf8tiu_13kW677f.mp4
Recording.1517.mp4
Expensify/Expensify Issue URL:
Issue reported by: @ayazhussain79
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1694202685326599
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: