Skip to content

[Due for payment 2025-05-27] [$250] Settings-Required field error is not displayed when clearing the field #60243

Closed

Description

@mitarachim

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.1.28-1
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: #56068
Email or phone of affected tester (no customers): agexptest+pr1504@gmail.com
Issue reported by: Applause Internal Team
Device used: Windows 10/ Chrome, Samsung S23FE/ Android 14
App Component: User Settings

Action Performed:

  1. Go to https://staging.new.expensify.com/
  2. Log in with any Expensify account
  3. Go to Settings > Profile
  4. Click on Status > Clear after > Custom > Date
  5. Choose any date
  6. Clear the field
  7. Verify that the required field error is displayed
  8. Go back
  9. Click on Date again
  10. Clear the field by clicking the X button twice without closing the date picker

Expected Result:

The required field error is displayed after clearing the field, even when the date picker is open.

Actual Result:

The required field error is not displayed when clearing the field without closing the date picker.

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6802380_1744694724631.No_required_field_error.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021917203087848355414
  • Upwork Job ID: 1917203087848355414
  • Last Price Increase: 2025-05-06
  • Automatic offers:
    • daledah | Contributor | 107210364
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @lydiabarclay

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    DeployBlockerIndicates it should block deploying the API
    DeployBlockerCashThis issue or pull request should block deployment
    on Apr 15, 2025
  2. melvin-bot commented on Apr 15, 2025

    @melvin-bot

    Triggered auto assignment to @lydiabarclay (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.

  3. melvin-bot commented on Apr 15, 2025

    @melvin-bot

    Triggered auto assignment to @mollfpr (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  4. melvin-bot commented on Apr 15, 2025

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  5. github-actions commented on Apr 15, 2025

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  6. daledah commented on Apr 15, 2025

    @daledah
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-04-29 13:09:51 UTC.

    Proposal

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

    The required field error is not displayed when clearing the field without closing the date picker.

    What is the root cause of that problem?

    Offending PR

    This is a hidden bug that only appeared after the offending PR.

    When validating error, we only keep the fields that is touched:

    const touchedInputErrors = Object.fromEntries(Object.entries(validateErrors).filter(([inputID]) => touchedInputs.current[inputID]));

    But when dismissing the date picker, there's no onTouched call:

    const closeDatePicker = useCallback(() => {
    textInputRef.current?.blur();
    setIsModalVisible(false);
    }, []);

    And when clicking clear button, onTouched is called with delay:

    setTimeout(() => {
    setTouchedInput(inputID);
    }, VALIDATE_DELAY);

    While onValidate is called immediately when input change:

    onValidate(newState);

    So when calling onValidate there's no data for the input in the touchedInputs ref, resulting in errors returned empty and no error is shown.

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

    We should call onTouched when closing modal

    const closeDatePicker = useCallback(() => {
    textInputRef.current?.blur();
    setIsModalVisible(false);
    }, []);

        const closeDatePicker = useCallback(() => {
            textInputRef.current?.blur();
            setIsModalVisible(false);
            onTouched();
        }, [onTouched]);

    OR we can add setTouchedInput before onValidate in onInputChange here:

    if (shouldValidateOnChange) {
    onValidate(newState);
    }

    Same as onBlur:

    setTouchedInput(inputID);
    // We don't validate the form on blur in case the current screen is not focused
    if (shouldValidateOnBlur && isFocusedRef.current) {
    onValidate(inputValues, !hasServerError);
    }

    To address this comment, remove shouldShowClearButton in these components:

    shouldShowClearButton

    shouldShowClearButton

    shouldShowClearButton

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    None

    What alternative solutions did you explore? (Optional)

    This logic

    setTimeout(() => {
    setTouchedInput(inputID);
    }, VALIDATE_DELAY);

    was added in this PR to fix this bug. However, I tried removing the timeout and the bug is not reproduced anymore, so we can remove it.

    setTimeout(() => {
    setTouchedInput(inputID);
    }, VALIDATE_DELAY);

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  7. daledah commented on Apr 15, 2025

    @daledah
    Contributor

    I can help raise a quick PR if needed.

  8. 74 remaining items

  9. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on May 20, 2025
  10. changed the title [-][$250] Settings-Required field error is not displayed when clearing the field[/-] [+][Due for payment 2025-05-27] [$250] Settings-Required field error is not displayed when clearing the field[/+] on May 20, 2025
  11. melvin-bot commented on May 20, 2025

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  12. melvin-bot commented on May 20, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.46-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 2025-05-27. 🎊

    For reference, here are some details about the assignees on this issue:

  13. melvin-bot commented on May 20, 2025

    @melvin-bot

    @s77rt @lydiabarclay @s77rt The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  14. s77rt commented on May 25, 2025

    @s77rt
    Member

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: [Form Provider Refactor] AddDebitCardPage #29983 (comment)

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: n/a

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

      Bug requires regression test: No. this is a pretty minor bug

  15. lydiabarclay commented on May 27, 2025

    @lydiabarclay
    Contributor

    Payment Summary

    Contributor: @daledah paid $250 via Upwork
    Contributor+: @s77rt due $250 via NewDot

    ✅ No regression test needed

  16. JmillsExpensify commented on May 29, 2025

    @JmillsExpensify
    Contributor

    $250 approved for @s77rt

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions