Skip to content
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 2024-04-05] [$250] Web - Inconsistent behavior when saving existing name without edit #38668

Closed
1 of 6 tasks
kbecciv opened this issue Mar 20, 2024 · 43 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

@kbecciv
Copy link

kbecciv commented Mar 20, 2024

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: 1.4.55-0
Reproducible in staging?: y
Reproducible in production?: new feature
Issue reported by: Applause - Internal Team

Action Performed:

Precondition:

  • User is admin of Collect workspace.
  • The Collect workspace has categories and tags.
  1. Go to staging.new.expensify.com.
  2. Go to Profile > Workspaces > Collect workspace.
  3. Go to Categories.
  4. Click on any category.
  5. Click Category name.
  6. Save the name without editing.
  7. Note that an error shows up.
  8. Go to Tags.
  9. Click on any tag.
  10. Click Tag name.
  11. Save the name without editing.

Expected Result:

When saving category and tag name without editing, the behavior should be consistent. If error is meant to show up, it should show up for both. Otherwise, there should be no error for both.

For any feature - Category, tag, distance or tax, when the name is being changed but no change has been done, do nothing and just close the modal (skip the API call too)

Actual Result:

In Step 6, error shows up when saving category name without editing it.
In Step 11, no error shows up when saving tag name without editing it.

Workaround:

n/a

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6420400_1710936083255.20240320_194746.1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~017d373a5e049d77c6
  • Upwork Job ID: 1770442815835451392
  • Last Price Increase: 2024-03-20
  • Automatic offers:
    • GandalfGwaihir | Contributor | 0
    • shubham1206agra | Contributor | 0
Issue OwnerCurrent Issue Owner: @shubham1206agra
@kbecciv kbecciv added the DeployBlockerCash This issue or pull request should block deployment label Mar 20, 2024
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.

Copy link

melvin-bot bot commented Mar 20, 2024

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

@kbecciv kbecciv changed the title Categories & Tags - Inconsistent behavior when saving existing name without edit Web - Categories & Tags - Inconsistent behavior when saving existing name without edit Mar 20, 2024
@mountiny mountiny added Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Mar 20, 2024
@mountiny mountiny assigned mountiny and unassigned cristipaval Mar 20, 2024
@mountiny
Copy link
Contributor

This is not a blocker, its a new feature, I can take over.

@allgandalf
Copy link
Contributor

allgandalf commented Mar 20, 2024

Proposal

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

Categories & Tags - Inconsistent behavior when saving existing name without edit

What is the root cause of that problem?

We have duplicate tag check but it is wrong:

const validate = useCallback(
(values: FormOnyxValues<typeof ONYXKEYS.FORMS.WORKSPACE_TAG_FORM>) => {
const errors: FormInputErrors<typeof ONYXKEYS.FORMS.WORKSPACE_TAG_FORM> = {};
const tagName = values.tagName.trim();
const {tags} = PolicyUtils.getTagList(policyTags, 0);
if (!ValidationUtils.isRequiredFulfilled(tagName)) {
errors.tagName = 'workspace.tags.tagRequiredError';
} else if (tags?.[tagName] && currentTagName !== tagName) {
errors.tagName = 'workspace.tags.existingTagError';
}

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

Update duplicate category check similar to tag check:

} else if (policyCategories?.[newCategoryName]) {
errors.categoryName = 'workspace.categories.existingCategoryError';

This check should be updated to:

} else if (policyCategories?.[newCategoryName] && currentCategoryName !== newCategoryName) { 
     errors.categoryName = 'workspace.categories.existingCategoryError'; 

Now we also shouldn't make a API call if we have made no changes, so update the following:

const editTag = useCallback(
(values: FormOnyxValues<typeof ONYXKEYS.FORMS.WORKSPACE_TAG_FORM>) => {
Policy.renamePolicyTag(route.params.policyID, {oldName: currentTagName, newName: values.tagName.trim()});
Keyboard.dismiss();
Navigation.dismissModal();
},
[route.params.policyID, currentTagName],
);

TO:

 const editTag = useCallback( 
     (values: FormOnyxValues<typeof ONYXKEYS.FORMS.WORKSPACE_TAG_FORM>) => { 
        if(!(policyCategories?.[newCategoryName] && currentCategoryName !== newCategoryName)){
         Policy.renamePolicyTag(route.params.policyID, {oldName: currentTagName, newName: values.tagName.trim()}); 
         }
         Keyboard.dismiss(); 
         Navigation.dismissModal(); 
     }, 
     [route.params.policyID, currentTagName], 
 ); 

Similar would be done on category page.

What alternative solutions did you explore? (Optional)

N/A

@allgandalf
Copy link
Contributor

allgandalf commented Mar 20, 2024

I think we should update duplicate category check from the edit category page , what about you @mountiny ?

@cristipaval
Copy link
Contributor

This is not a blocker, its a new feature, I can take over.

Thanks @mountiny ! 🙏

@mountiny mountiny changed the title Web - Categories & Tags - Inconsistent behavior when saving existing name without edit Web - Inconsistent behavior when saving existing name without edit Mar 20, 2024
@mountiny mountiny added the External Added to denote the issue can be worked on by a contributor label Mar 20, 2024
@melvin-bot melvin-bot bot changed the title Web - Inconsistent behavior when saving existing name without edit [$500] Web - Inconsistent behavior when saving existing name without edit Mar 20, 2024
Copy link

melvin-bot bot commented Mar 20, 2024

Job added to Upwork: https://www.upwork.com/jobs/~017d373a5e049d77c6

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 20, 2024
Copy link

melvin-bot bot commented Mar 20, 2024

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

Copy link

melvin-bot bot commented Mar 20, 2024

⚠️ This issue has had its price increased by 4x or more. Please review the issue and ensure the price is correct.

Copy link

melvin-bot bot commented Mar 20, 2024

Upwork job price has been updated to $500

@Krishna2323
Copy link
Contributor

Proposal

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

Web - Inconsistent behavior when saving existing name without edit

What is the root cause of that problem?

We don't check if the value is changed or not before validating here:

} else if (policyCategories?.[newCategoryName]) {

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

Update the line to use the categoryName passed from EditCategoryPage to check if the new name is the same or not:
else if (policyCategories?.[newCategoryName] && categoryName !== newCategoryName)

Result

@allgandalf
Copy link
Contributor

Updated proposal

Updated my proposal to also not call the api if we make no edits

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Mar 21, 2024
@allgandalf
Copy link
Contributor

PR ready for review c.c. @shubham1206agra

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Mar 29, 2024
@melvin-bot melvin-bot bot changed the title [$250] Web - Inconsistent behavior when saving existing name without edit [HOLD for payment 2024-04-05] [$250] Web - Inconsistent behavior when saving existing name without edit Mar 29, 2024
Copy link

melvin-bot bot commented Mar 29, 2024

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Mar 29, 2024
Copy link

melvin-bot bot commented Mar 29, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.57-5 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 2024-04-05. 🎊

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

@shubham1206agra
Copy link
Contributor

@mountiny Please assign me here as C+

Copy link

melvin-bot bot commented Mar 29, 2024

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

@mountiny mountiny added the Bug Something is broken. Auto assigns a BugZero manager. label Mar 29, 2024
@mountiny
Copy link
Contributor

$250 to @GandalfGwaihir and $250 to @shubham1206agra

Copy link

melvin-bot bot commented Mar 29, 2024

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

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Mar 29, 2024
@mountiny mountiny added Weekly KSv2 and removed Daily KSv2 labels Mar 29, 2024
@slafortune
Copy link
Contributor

@shubham1206agra please accept this offer - https://www.upwork.com/nx/wm/offer/101650388
@GandalfGwaihir - Paid

@slafortune
Copy link
Contributor

@shubham1206agra please accept this offer - https://www.upwork.com/nx/wm/offer/101650388

@slafortune
Copy link
Contributor

I'll be out of the office until 4/22 and will check on this then.

@shubham1206agra
Copy link
Contributor

@slafortune Accepted the offer.

@allgandalf
Copy link
Contributor

Bump to @slafortune to close this one once @shubham1206agra gets paid :)

@slafortune
Copy link
Contributor

Yep, just back today! Paid and closing ✔️

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
No open projects
Archived in project
Development

No branches or pull requests

10 participants