Skip to content

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

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

Open
3 of 8 tasks
mitarachim opened this issue Apr 15, 2025 · 55 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@mitarachim
Copy link

mitarachim commented Apr 15, 2025

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] 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): [email protected]
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
@mitarachim mitarachim added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 DeployBlocker Indicates it should block deploying the API DeployBlockerCash This issue or pull request should block deployment labels Apr 15, 2025
Copy link

melvin-bot bot commented Apr 15, 2025

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.

Copy link

melvin-bot bot commented Apr 15, 2025

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

Copy link

melvin-bot bot commented Apr 15, 2025

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

@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Apr 15, 2025
Copy link
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.

@daledah
Copy link
Contributor

daledah commented Apr 15, 2025

🚨 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.

@daledah
Copy link
Contributor

daledah commented Apr 15, 2025

I can help raise a quick PR if needed.

@mollfpr
Copy link
Contributor

mollfpr commented Apr 15, 2025

Thanks @daledah for the proposal, but I think we will let the author fix the issue.

It's a pretty minor issue and shouldn't be a blocker. @perunt @shubham1206agra Please take a look when you have a chance.

@mollfpr mollfpr removed DeployBlockerCash This issue or pull request should block deployment DeployBlocker Indicates it should block deploying the API labels Apr 15, 2025
@mollfpr mollfpr added Daily KSv2 and removed Hourly KSv2 labels Apr 15, 2025
@shubham1206agra
Copy link
Contributor

@perunt I think we should not allow them to clear dates here maybe.

@lydiabarclay
Copy link

@mollfpr can I tag this as external if @shubham1206agra is going to be reviewing I assume?

@mollfpr
Copy link
Contributor

mollfpr commented Apr 16, 2025

@lydiabarclay I think it's not necessary. We will have @perunt and @shubham1206agra fix the issue.

@lydiabarclay
Copy link

lydiabarclay commented Apr 16, 2025

Just checking @mollfpr - I'm assuming @shubham1206agra will still require payment as they are an external contributor - how do we determine the payment timeline manually?

@mollfpr
Copy link
Contributor

mollfpr commented Apr 16, 2025

@lydiabarclay The payment will be process here, since this a regression from the PR.

how do we determine the payment timeline manually?

Sorry, I didn't get what you meant 😅

@lydiabarclay
Copy link

Oh @mollfpr I see! Thank you for clarifying.

@melvin-bot melvin-bot bot removed the Overdue label May 5, 2025
@daledah
Copy link
Contributor

daledah commented May 5, 2025

The bug is still reproducible

@s77rt What bug are you mentioning here? I tried removing timeout and both bugs in this issue and the mentioned issue is not reproducible

Screen.Recording.2025-05-05.at.22.09.33.mov

@s77rt
Copy link
Contributor

s77rt commented May 5, 2025

@daledah The bug is related to the checkbox as it shifts down after the error message is displayed

Screen.Recording.2025-05-05.at.8.10.30.PM.mov

@daledah
Copy link
Contributor

daledah commented May 6, 2025

@s77rt It works fine on my side. Can you check again please?

Screen.Recording.2025-05-06.at.22.45.54.mov

Small note that I only remove the timeout in onTouched and leave everything else as-is.

Copy link

melvin-bot bot commented May 6, 2025

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@s77rt
Copy link
Contributor

s77rt commented May 6, 2025

@daledah Ah okay. Yeah I think we can go with that.

🎀 👀 🎀 C+ reviewed
Link to proposal

Copy link

melvin-bot bot commented May 6, 2025

Current assignee @mollfpr is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@mollfpr
Copy link
Contributor

mollfpr commented May 7, 2025

Agree with @s77rt! Assigning, thanks!

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label May 7, 2025
Copy link

melvin-bot bot commented May 7, 2025

📣 @daledah 🎉 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 📖

@s77rt
Copy link
Contributor

s77rt commented May 12, 2025

Not overdue. Working on the PR still

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels May 12, 2025
@mollfpr
Copy link
Contributor

mollfpr commented May 15, 2025

The PR is merged! Melvin failed to update the status here 😅

@melvin-bot melvin-bot bot removed the Overdue label May 15, 2025
@mollfpr mollfpr added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels May 15, 2025
@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels May 20, 2025
@melvin-bot melvin-bot bot 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 May 20, 2025
Copy link

melvin-bot bot commented May 20, 2025

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label May 20, 2025
Copy link

melvin-bot bot commented May 20, 2025

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:

Copy link

melvin-bot bot commented May 20, 2025

@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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
Status: No status
Development

No branches or pull requests

9 participants