Closed lanitochka17 closed 6 months ago
Triggered auto assignment to @jliexpensify (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
@jliexpensify 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 #vip-vsp CC @quinthar
A new line is added to code block when saving unchanged description with code block
This is a issue with expensify-common library, we use replace
which leads to this bug:
Everytime we use replace
it adds a extra line to the start of the markdown
We can make use of the filterRules
in replace
:
https://github.com/Expensify/expensify-common/blob/77d0b150ba6bfbe7a64b3c3e30b65592b2e58c4a/lib/ExpensiMark.d.ts#L26-L27
In the taskDescriptionPage
, we need to apply the following markdownInBackticks
filter option:
defaultValue={parser.htmlToMarkdown((props.report && parser.replace(props.report.description, {
filterRules: ["markdownInBackticks"]
})) || '')}
Note: I won't recommend fixing this upstream as we use
parser
at many places and this is related to only markdown, so we can use thefilterRules
provided upstream to deal with this bug.
https://github.com/Expensify/App/assets/110545952/0edbe622-4a06-4aa3-8efe-a61a0320b836
Saving an unchanged codefence markdown will add 1 new line.
When we save a codefence markdown with new line,
hello
EditTask response will return the new line as \r\n
. Currently, codefence markdown regex only matches `` with
\n` as the opening tag.
https://github.com/Expensify/expensify-common/blob/77d0b150ba6bfbe7a64b3c3e30b65592b2e58c4a/lib/ExpensiMark.js#L33-L34
So, when we convert it to markdown, there will be an extra new line by \r\n
in the codefence content/body.
It's know that the sever might returns \r\n
as the new line as shown by the comment below.
https://github.com/Expensify/App/blob/9302ade9988b1cba3e07b48f474bc35a6deea7fb/src/pages/tasks/TaskDescriptionPage.tsx#L50-L51
To solve it case by case, we can also apply StringUtils.normalizeCRLF
to the task description before converting it to markdown when showing the task description in both TaskDescriptionPage and TaskView.
Update the codefence regex to match either \r\n
or \n
.
https://github.com/Expensify/expensify-common/blob/77d0b150ba6bfbe7a64b3c3e30b65592b2e58c4a/lib/ExpensiMark.js#L33-L34
/(```(?:\r\n|\n)?)((?:\s*?(?!(?:\r\n|\n)?```(?!`))[\S])+\s*?)((?=(?:\r\n|\n)?)```)/g
// the difference is instead of using \n, we use (?:\r\n|\n)
// ?: to not capture it as a group as it will broke the replacement logic
@jliexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
Job added to Upwork: https://www.upwork.com/jobs/~01e1f69c2987288ad8
Triggered auto assignment to Contributor-plus team member for initial proposal review - @DylanDylann (External
)
Sorry, was sick yesterday. Can repro - what a weird bug.
description
with \r\n
as the new line, this is also acknowledged by us here
Then in our parser, we only acknowledge the \n
as a possible new line after "```", if it's not there, we'll append new line, this leads to a new line being added each time we edit the task1.
is fixed, we'll be left with this
Although we didn't change anything, there's still another updated the description to
message, with spaces between the backticks and the text inside backticks.
This is because when we save
```hello```
as codeblock, we'll save it as is. Meanwhile, when we display it here, we normalize it by adding extra new lines, this is what we do in the main composer as well.
hello
Now when we save, it will be saved with the extra new lines, we detect changes and the updated the description to
is added. Although to the users, nothing changes at all.
\r\n
as possible new line character as well
/(```(?:\r\n|\n)?)((?:\s*?(?!(?:\r\n|\n)?```(?!`))[\S])+\s*?)((?=(?:\r\n|\n)?)```)/g
StringUtils.normalizeCRLF
on the report description whenever we try to display it to set it as default value of the input.Thanks for all your proposals
@GandalfGwaihir's proposal is to filter out the markdownInBackticks
rule and it's not correct since we need to add the extra line for description when users open edit task page
@bernhardoj's proposal doesn't fix the second point The system message for task descrption will not appear each time saving unchanged description with code block
@tienifr's solution makes sense since it fixes 2 points in the OP
🎀👀🎀 C+ reviewed
Triggered auto assignment to @johnmlee101, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
Waiting internal engineer give a final approval
❌ There was an error making the offer to @DylanDylann for the Reviewer role. The BZ member will need to manually hire the contributor.
❌ There was an error making the offer to @tienifr for the Contributor role. The BZ member will need to manually hire the contributor.
Triggered auto assignment to @muttmuure (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
Hi @muttmuure - I am headed OOO from 21st to 31st March. Here's a summary of where we are at:
PAYMENT SUMMARY
I'll grab this one if when I'm back, thanks!
@tienifr Is there any update here?
@DylanDylann https://github.com/Expensify/expensify-common/pull/669, https://github.com/Expensify/App/pull/38908 these PRs are ready for review.
Back, removed Matt!
Reviewing
label has been removed, please complete the "BugZero Checklist".
The solution for this issue has been :rocket: deployed to production :rocket: in version 1.4.58-8 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-04-09. :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:
BugZero Checklist:
Regression test:
```task description```
Do we 👍 or 👎
Paid and job closed
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: Reproducible in staging?: Reproducible in production?: 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 Expensify/Expensify Issue URL: Issue reported by: Applause - Internal team Slack conversation:
Action Performed:
Expected Result:
No extra line will be added each time saving unchanged description with code block The system message for task descrption will not appear each time saving unchanged description with code block
Actual Result:
An extra line will be added each time saving unchanged description with code block The system message for task descrption appears each time saving unchanged description with code block
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/Expensify/App/assets/78819774/8aa25040-22c1-4c67-95bf-2b40abe3654d
View all open jobs on GitHub
Upwork Automation - Do Not Edit