Closed lanitochka17 closed 3 weeks ago
Triggered auto assignment to @garrettmknight (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
@garrettmknight FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
We think that this bug might be related to #wave-control
Job added to Upwork: https://www.upwork.com/jobs/~021841561644716083523
Triggered auto assignment to Contributor-plus team member for initial proposal review - @suneox (External
)
Edited by proposal-police: This proposal was edited at 2024-10-03 13:17:41 UTC.
Attachment from qa.guide loads infinitely when opened in Search
The reason for this ticket is that we are attempting to authenticate an attachment that is not an Expensify source, which prevents the attachment from loading and results in an infinite loading state.
In the case of this ticket, this GIF will use AttachmentView
, and the isAuthTokenRequired
prop will be set to true
to render this GIF. AttachmentView
is used because when the attachment modal is opened, the URL contains reportID
set to -1
, which prevents load the report. According to condition check #L542, AttachmentView
should be rendered for this case. Additionally, this GIF is opened from Search, where isAuthTokenRequired
is true
, as indicated by condition #L49.
So, this GIF is not an Expensify source and will require authentication, as isAuthTokenRequired is set to true, as I mentioned. Therefore, this GIF can't load.
I suggest two options to fix this issue:
// .src/components/SelectionList/ChatListItem.tsx#L43
- const attachmentContextValue = {type: CONST.ATTACHMENT_TYPE.SEARCH};
+ const attachmentContextValue = {reportID: item.reportID, type: CONST.ATTACHMENT_TYPE.SEARCH};
// .src/components/AttachmentModal.tsx#L543
+ const [isImageAuthTokenRequired, setImageAuthTokenRequired] = useState(isAuthTokenRequired);
- {!shouldShowNotFoundPage &&
- (!isEmptyObject(report) && !isReceiptAttachment ? (
+ {!shouldShowNotFoundPage &&
+ (!isEmptyObject(report) && !isReceiptAttachment && type !== CONST.ATTACHMENT_TYPE.SEARCH ? (
<AttachmentCarousel
....
// .src/components/Attachments/AttachmentView/index.tsx#L238
+ const compareImage = useCallback((attachment: Attachment) => attachment.source === source, [source]);
+ useEffect(() => {
+ if (type !== CONST.ATTACHMENT_TYPE.SEARCH) return;
+ const prReportAction = report?.parentReportActionID && parentReportActions ? parentReportActions[report?.parentReportActionID] : undefined;
+ const newAttachments: Attachment[] = extractAttachments(CONST.ATTACHMENT_TYPE.REPORT, {parentReportAction: prReportAction, reportActions: reportActions ?? undefined});
+ const newIndex = newAttachments.findIndex(compareImage);
+ const attachment = newAttachments.at(newIndex);
+ if (attachment?.isAuthTokenRequired !== undefined) {
+ setImageAuthTokenRequired(attachment?.isAuthTokenRequired);
+ }
+ }, [compareImage, parentReportActions, report?.parentReportActionID, reportActions, type]);
// .src/components/AttachmentModal.tsx#L291
<AttachmentViewImage
....
+ isAuthTokenRequired={type === CONST.ATTACHMENT_TYPE.SEARCH ? isImageAuthTokenRequired : isAuthTokenRequired}
// .src/components/SelectionList/ChatListItem.tsx#L43
- const attachmentContextValue = {type: CONST.ATTACHMENT_TYPE.SEARCH};
+ const attachmentContextValue = {reportID: item.reportID, type: CONST.ATTACHMENT_TYPE.SEARCH};
We’re still awaiting a proposal on this issue. The RCA and solution provided by @huult proposal are not correct.
@suneox @lanitochka17 I think the "Action performed:" steps and the provided video are not clear to users who are not familiar with Expensify. How to see #admins
chat ? What steps should be done to have this message in somewhere to copy and test
@shahinyan11 At step 3 you have to copy content Send the following message ( ... ) included image
Edited by proposal-police: This proposal was edited at 2024-10-03 18:12:20 UTC.
Search - Attachment from qa.guide loads infinitely when opened in Search
Here Is described in which cases the image need to have an authToken
to be loaded. But the current case is not one of the described cases and we still add authToken
to load the image.
It comes from here because we set isAuthTokenRequired
based on ATTACHMENT_TYPE
constant but I think the isAuthTokenRequired
prop should be set based on this value.
Add one more isAuthTokenRequired
param in attachments route here obj
Add isAttachmentOrReceipt
as a last param in here
const route = ROUTES.ATTACHMENTS?.getRoute(reportID ?? '-1', type, source, accountID, isAttachmentOrReceipt);
Update the isAuthTokenRequired prop value to route.params.isAuthTokenRequired
@shahinyan11 At step 3 you have to copy content
Send the following message ( ... ) included image
@suneox Thanks for your help.
@suneox, could you please check again? Thank you.
Thanks for all the proposals. I don’t think this issue is related to CORS blocking, since the images from both the chat and the search load the same resource url, just only the headers being different.
https://github.com/user-attachments/assets/a366626c-ed5f-4f8a-9b30-1c047b5ee101
@shahinyan11 Your solution doesn't work on my side
To resolve this issue, we can read the image from the cache to display it when opening the attachment. To retrieve the image from the cache, we update the parameters in the URL to match those of the previous image load.
@huult Could you please explain why updating the reportID parameter in the URL allows us to get a cached image, even though the image source (attachment?source) from URL does not change?
@suneox Do you mean that my solution doesn't work at all or it's a workaround?
@suneox Do you mean that my solution doesn't work at all or it's a workaround?
@shahinyan11 Your solution doesn’t work as expected, the image still loads indefinitely
https://github.com/user-attachments/assets/598f84b5-9f89-4a63-aa7d-f9e7a1f0d875
Updated. I have updated the RCA and solution. Could you check please and leave feedback
Thanks for all the updates. I’ll reevaluate them within today.
Although both solutions can resolve the issue but @shahinyan11’s solution is simpler. Instead of always setting isAuthTokenRequired
in the attachment search case, we will retrieve the isAuthTokenRequired
status from the previous thumbnail so we can proceed with @shahinyan11 solution.
🎀 👀 🎀 C+ reviewed
Triggered auto assignment to @cead22, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
📣 @suneox 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!
📣 @shahinyan11 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!
Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑💻 Keep in mind: Code of Conduct | Contributing 📖
Reviewing
label has been removed, please complete the "BugZero Checklist".
The solution for this issue has been :rocket: deployed to production :rocket: in version 9.0.49-2 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2024-10-24. :confetti_ball:
For reference, here are some details about the assignees on this 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:
All paid out!
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9.0.42-0 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Email or phone of affected tester (no customers): applausetester+kh010901@applause.expensifail.com Issue reported by: Applause - Internal Team
Action Performed:
Expected Result:
The attachment will load without issue
Actual Result:
The attachment loads infinitely This issue only happens to this specific attachment
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/user-attachments/assets/e01f2bbd-a43a-4abd-a34e-271b8b8ee4f1
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @garrettmknight