Skip to content

[$500] Web - Error doesn't disappear for a while after deleting entire max exceed message. #27698

Closed

Description

@kbecciv

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Go to any report.
  2. Paste a message that has over 15,000 characters. Notice now the Composer has red border with the error below.
  3. Delete entire message.
  4. Notice that Composer still has error for a while after deleting message.

Expected Result:

Error should disappear right after user deleted the message.

Actual Result:

Composer still has error for a while after deleting message.

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.71.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

Screen.Recording.2023-09-17.at.14.50.21.mov
Recording.4576.mp4

Expensify/Expensify Issue URL:
Issue reported by: @hungvu193
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1694937014673629

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01bef70e1146af3c78
  • Upwork Job ID: 1713723076177219584
  • Last Price Increase: 2023-10-16

Activity

  1. added
    External
    Daily
    Bug
    on Sep 18, 2023
  2. changed the title [-]Web - Error doesn't disappear for a while after deleting entire max exceed message.[/-] [+][$500] Web - Error doesn't disappear for a while after deleting entire max exceed message.[/+] on Sep 18, 2023
  3. melvin-bot commented on Sep 18, 2023

    @melvin-bot

    Triggered auto assignment to @jliexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

  4. melvin-bot commented on Sep 18, 2023

    @melvin-bot
  5. melvin-bot commented on Sep 18, 2023

    @melvin-bot

    Bug0 Triage Checklist (Main S/O)

    • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
    • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
      • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
    • This bug is reproducible using the reproduction steps in the OP. S/O
      • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
      • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
    • This issue is filled out as thoroughly and clearly as possible
      • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
    • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync
  6. added
    Help Wanted
    on Sep 18, 2023
  7. melvin-bot commented on Sep 18, 2023

    @melvin-bot

    Triggered auto assignment to @sonialiap (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

  8. melvin-bot commented on Sep 18, 2023

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane (External)

  9. DylanDylann commented on Sep 18, 2023

    @DylanDylann
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    • Error doesn't disappear for a while after deleting entire max exceed message.

    What is the root cause of that problem?

    • Currently, the border error is display based on hasExceededMaxCommentLength
    • hasExceededMaxCommentLength is set by debounce function updateCommentLength(comment,onExceededMaxCommentLength) - delay 500ms and the comment params is get from the ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT that is also updated by the debounce function (1000ms)
      const updateCommentLength = useMemo(
      () =>
      debounce((comment, onExceededMaxCommentLength) => {
      const newCommentLength = ReportUtils.getCommentLength(comment);
      setCommentLength(newCommentLength);
      onExceededMaxCommentLength(newCommentLength > CONST.MAX_COMMENT_LENGTH);
      }, CONST.TIMING.COMMENT_LENGTH_DEBOUNCE_TIME),
      [],
      );
      useEffect(() => {
      updateCommentLength(props.comment, props.onExceededMaxCommentLength);
      }, [props.comment, props.onExceededMaxCommentLength, updateCommentLength]);
    • It leads to after clearing all the input, it will delay for a while after removing the border error

    What changes do you think we should make in order to solve the problem?

    • These are 2 methods to reduce the delay time when update the border error:
    1. (Reduce 1000ms delay) In here
      debounce((comment, onExceededMaxCommentLength) => {
      we can get the comment param from the value state
      const [value, setValue] = useState(() => getDraftComment(reportID) || '');
      rather than the ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT
      comment: {
      key: ({reportID}) => `${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${reportID}`,
      because the ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT will be updated by the debounce function.
    2. (Reduce 500ms): Call the updateCommentLength(comment,onExceededMaxCommentLength) without delay.
      const updateCommentLength = useMemo(
      () =>
      debounce((comment, onExceededMaxCommentLength) => {
      const newCommentLength = ReportUtils.getCommentLength(comment);
      setCommentLength(newCommentLength);
      onExceededMaxCommentLength(newCommentLength > CONST.MAX_COMMENT_LENGTH);
      }, CONST.TIMING.COMMENT_LENGTH_DEBOUNCE_TIME),
      [],
      );

      Also we can remove the commentLenght state here because will don't need to display exact comment length (like "12370/10000"), just need to know whether it is greater than 10.000 or not
      const [commentLength, setCommentLength] = useState(0);
      . So the updateCommentLength function just call onExceededMaxCommentLength(newCommentLength > CONST.MAX_COMMENT_LENGTH), not affect the performance
    • So combining these two method will reduce 1500ms delay time when update the border error

    What alternative solutions did you explore? (Optional)

    • NA

    Result

    Screencast.from.19-09-2023.00.20.01.webm
  10. 82 remaining items

  11. Ollyws commented on Nov 1, 2023

    @Ollyws
    Contributor

    @DylanDylann How do you plan to get the value variable to the ExceededCommentLength component, given it's in ReportActionCompose and not ComposerWithSuggestions?

  12. DylanDylann commented on Nov 1, 2023

    @DylanDylann
    Contributor

    @Ollyws yeah, it is my plan

  13. Ollyws commented on Nov 1, 2023

    @Ollyws
    Contributor

    But how exactly?

  14. DylanDylann commented on Nov 1, 2023

    @DylanDylann
    Contributor

    Yeah. I still go with this solution because it is very straightforward

  15. Ollyws commented on Nov 1, 2023

    @Ollyws
    Contributor

    @DylanDylann I'm asking how will you get the value variable from ComposerWithSuggestions to ReportActionCompose?
    You're planning to move the whole thing into ReportActionCompose and pass it to ComposerWithSuggestions?

  16. DylanDylann commented on Nov 1, 2023

    @DylanDylann
    Contributor

    @Ollyws Sorry for misunderstood your question

  17. DylanDylann commented on Nov 6, 2023

    @DylanDylann
    Contributor

    @Ollyws Please help review my solution here when you have a chance #27698 (comment)

  18. Ollyws commented on Nov 6, 2023

    @Ollyws
    Contributor

    I think given that there is another issue #30921 open for the edit message character limit not working, and that while some proposals can mitigate this slightly it's essentially impossible to fix completely without removing the debounce, so along with my previous reasoning I vote to close this.

  19. DylanDylann commented on Nov 7, 2023

    @DylanDylann
    Contributor

    @jliexpensify What do you think about this one #27698 (comment)?

  20. jliexpensify commented on Nov 8, 2023

    @jliexpensify
    Contributor

    @DylanDylann in all honesty, I'm going to defer to @Ollyws here - my main role is to help troubleshoot and manage the issue, and as the C+, Olly should be finding suitable proposals. Given that he's already mentioned that it's an edge case and this issue should be closed a few times already, I'm inclined to lean towards this as well - also this statement indicates we won't really be solving the issue?

    it's essentially impossible to fix completely without removing the debounce

    If Olly did think it was an actual issue, my understanding is that he would have chosen a proposal and asked for an internal engineering review. Going to close this one out!

  21. DylanDylann commented on Nov 8, 2023

    @DylanDylann
    Contributor

    Many thanks @jliexpensify and @Ollyws

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugDailyEngineeringInternal

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions