-
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-05-25] [$1000] Space appears for a brief moment in the LHN message before correcting it if a codeblock has a space at the beginning #17896
Comments
Triggered auto assignment to @miljakljajic ( |
Bug0 Triage Checklist (Main S/O)
|
Hello, I can fix this issue. |
📣 @sheelyeng! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Format:
|
Contributor details |
ProposalPlease re-state the problem that we are trying to solve in this issue.
What is the root cause of that problem?
What changes do you think we should make in order to solve the problem?
What alternative solutions did you explore? (Optional)
|
Posting proposal early as per new guidelines ProposalPlease re-state the problem that we are trying to solve in this issue.When LHN last message starts with code block markdown that has leading spaces within the code block e.g. " What is the root cause of that problem?When we construct the optimisticReport.lastMessageText in App/src/libs/actions/Report.js Lines 205 to 212 in 6fb0969
and Report.js#editReportComment App/src/libs/actions/Report.js Lines 925 to 928 in 6fb0969
We uses Lines 489 to 493 in 6fb0969
Current ReportUtils.formatReportLastMessageText logic:
=> Note that there is no trimming of leading and trailing spaces What happened is that existing optimisticReport.lastMessageText construction logic will results in " e.g. pusher event [
{
"onyxMethod": "merge",
"key": "report_1346288692300822",
"value": {
"reportID": "1346288692300822",
"maxSequenceNumber": 15,
"lastVisibleActionCreated": "2023-04-27 08:12:55.117",
"lastReadTime": "2023-04-27 08:12:55.117",
"lastMessageText": "hello",
"lastActorEmail": "[email protected]"
}
}
] Therefore, the root cause is inconsistency between formatting/construction rule between the App and backend server. What changes do you think we should make in order to solve the problem?First, we should update the construction logic of optimisticReport.lastMessageText to include trimming of leading and trailing spaces to align with backend server, by modifying Lines 489 to 493 in 6fb0969
and App/src/libs/ReportActionsUtils.js Lines 161 to 164 in 6fb0969
to include trim(). However, that alone is not sufficient, because the input text can contains space in html encoded format e.g. To achieve what we need, we also need to ensure decoding happen before trim (currently htmlDecode is done at last step):
Since htmlDecode is changed to be done within App/src/libs/actions/Report.js Line 209 in 6fb0969
and App/src/libs/actions/Report.js Line 927 in 6fb0969
as they are no longer required Test results:Screen.Recording.2023-05-01.at.9.43.26.PM.movWhat alternative solutions did you explore? (Optional)Add trim() to text displayed in LHN list
which would works visually, but that approach does not resolve the discrepancies between optimistic data and actual pushed events from server, so I would avoid that. |
@honnamkuan , I think, logically there is no difference whether we add In case you want to add Additional places you should add the
But as you can see we need to add the
There would be a better solution to make the repo more professional. |
@sheelyeng I believe my solution works well, I have added a No doubt your solution of trimming in the UI works as well. It is just that my preference would be to ensure Onyx data stays consistent in both optimistic and success data to avoid surprises in the future, even if it involves making more code changes. I guess if this issue is open to External, it would be up to the C+ reviewers to review and decide which proposal approach they prefer. |
Job added to Upwork: https://www.upwork.com/jobs/~016119f8050196b168 |
Current assignee @miljakljajic is eligible for the External assigner, not assigning anyone new. |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @rushatgabhane ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Space appears for a brief moment in the LHN message before correcting it if a codeblock has a space at the beginning. What is the root cause of that problem?When sending a code block with leading spaces
We build optimistic report data through method buildOptimisticAddCommentReportAction and parse the markdown code fence into html through method ExpensiMark.replace. In the codeFence-to-html rule, we replace whitespace with html code In method buildOptimisticAddCommentReportAction, the code block is translated into message html string <pre>   test</pre> and the message html string is converted to message text string here through method ExpensiMark.htmlToText.
Then we format optimistic data of App/src/libs/actions/Report.js Lines 205 to 209 in 8d661d2
by extracting the first row of message text, So before backend return the trimmed When editing the code block message, we also convert message html string into text string, extract the first line and decode it with Str.htmlDecode to get optimistic Based on the above analysis, the root cause of this issue can be that, in method ExpensiMark.htmlToText, we don't replace What changes do you think we should make in order to solve the problem?To fix this issue, we can replace We can add a new rule to htmlToTextRules to replace {
name: 'replaceClassicSpaces',
regex: / /gi,
replacement: ' ',
} And trim the text before return here. What alternative solutions did you explore? (Optional)N/A |
Triggered auto assignment to @robertjchen ( |
Thanks for the proposals! I like @honnamkuan 's approach in addressing it at the root While I understand @sheelyeng 's point about doing it at the UI level, I think the former approach would help us avoid bugs in the future. What do you think @rushatgabhane ? 🙏 |
hi @robertjchen i agree. @honnamkuan's proposal will prevent any surprises in the future. |
Hi @robertjchen @rushatgabhane , I think my proposal #17896 (comment) explains the root cause better and provides a more fundamental solution. Can I get a feedback from you on my proposal? Thank you! |
@miljakljajic thank you. I accepted the offer. |
📣 @honnamkuan You have been assigned to this job by @robertjchen! |
📣 @gabrialva! 📣
|
@robertjchen @rushatgabhane the PR is ready for review, thanks. |
I'll be OOO at EC3 and then taking some time off for a wedding. I'll reassign to another BZ member to process the payments. Contracts have been extended, just need to pay when the time comes! |
Triggered auto assignment to @sakluger ( |
This comment was marked as duplicate.
This comment was marked as duplicate.
PR merged yesterday |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.15-12 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-05-25. 🎊 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.
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:
|
It looks like this was merged 2-3 biz days after assignment, so it qualifies for the efficiency bonus 🎉 @rushatgabhane can you please complete the BugZero checklist? Once you do, I'll complete payments thorugh upwork. |
|
@sakluger completed the checklist! Thanks! |
Thanks @rushatgabhane, and thanks everyone for the quick work on this one! Closing out. |
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:
Hello test
Expected Result:
App should not display space before text in LHN
Actual Result:
App displays space before text in LHN for few seconds when we send code block with space before text in it.
Workaround:
Can the user still use Expensify without this being fixed? Have you informed them of the workaround?
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.4
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
space.before.text.in.LHN.for.few.seconds.mp4
Recording.345.mp4
Expensify/Expensify Issue URL:
Issue reported by: @dhanashree-sawant
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1682331727011769
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: