Skip to content

[$250] Attendee selector shows form error as soon as you open up the RHP #62325

Closed

Description

@m-natarajan

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?: Needs Reproduction
Reproducible in production?: Needs Reproduction
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: @shawnborton
Slack conversation (hyperlinked to channel name): #Expensify Bugs

Action Performed:

  1. Open a submitted card expense as approver (viewing an expense with no attendees selected)
  2. Click the Attendees button
  3. Observe the RHN

Expected Result:

RBR should not displayed or wait until the form is submitted

Actual Result:

RBR displayed immediately after opening the Attendees

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop
Platforms Tested: On which of our officially supported platforms was this issue tested:
  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
CleanShot.2025-05-19.at.10.56.44.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021924919128693635846
  • Upwork Job ID: 1924919128693635846
  • Last Price Increase: 2025-05-27
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @allroundexperts

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on May 19, 2025
  2. melvin-bot commented on May 19, 2025

    @melvin-bot

    Triggered auto assignment to @alexpensify (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. Krishna2323 commented on May 19, 2025

    @Krishna2323
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-05-19 21:41:11 UTC.

    Proposal

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

    Attendee selector shows form error as soon as you open up the RHP

    What is the root cause of that problem?

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

    • We should create a state for shouldShowErrorMessage and set that to true when we click confirm button and attendees length is 0.
      const handleConfirmSelection = useCallback(
      (_keyEvent?: GestureResponderEvent | KeyboardEvent, option?: Option) => {
      if (shouldShowErrorMessage || (!attendees.length && !option)) {
      return;
      }
      onFinish(CONST.IOU.TYPE.SUBMIT);
      },
      [shouldShowErrorMessage, onFinish, attendees],
      );
        const [shouldShowErrorMessage, setShouldShowErrorMessage] = useState(false);
    
        const handleConfirmSelection = useCallback(
            (_keyEvent?: GestureResponderEvent | KeyboardEvent, option?: Option) => {
                if (attendees.length < 1 && !option) {
                    setShouldShowErrorMessage(true);
                    return;
                }
    
                onFinish(CONST.IOU.TYPE.SUBMIT);
            },
            [onFinish, attendees],
        );
    • We should also set shouldShowErrorMessage to false when addAttendeeToSelection is called.
      const addAttendeeToSelection = useCallback(
      (option: Option) => {
      const isOptionSelected = (selectedOption: Attendee) => {
      if (selectedOption.accountID && selectedOption.accountID === option?.accountID) {
      return true;
      }
      if (selectedOption.email && selectedOption.email === option?.login) {
      return true;
      }
      return false;
      };
      const isOptionInList = attendees.some(isOptionSelected);
      let newSelectedOptions: Attendee[];
      if (isOptionInList) {
      newSelectedOptions = lodashReject(attendees, isOptionSelected);
      } else {
      const iconSource = option.icons?.[0]?.source;
      const icon = typeof iconSource === 'function' ? '' : iconSource?.toString() ?? '';
      newSelectedOptions = [
      ...attendees,
      {
      accountID: option.accountID ?? CONST.DEFAULT_NUMBER_ID,
      // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
      login: option.login || option.text,
      // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
      email: option.login || (option.text ?? ''),
      displayName: option.text ?? '',
      selected: true,
      searchText: option.searchText,
      avatarUrl: option.avatarUrl ?? icon,
      iouType,
      },
      ];
      }
      onAttendeesAdded(newSelectedOptions);
    • Then we can also remove this condition, which hides the save button when shouldShowErrorMessage is false and attendees length is 0.
      const footerContent = useMemo(() => {
      if (!shouldShowErrorMessage && !attendees.length) {
      return;
      }
      return (
      <>
      {shouldShowErrorMessage && (
      <FormHelpMessage
      style={[styles.ph1, styles.mb2]}
      isError
    • Optional: attendees.length < 1 is true and we have an option in handleConfirmSelection, we can call addAttendeeToSelection with the option.
    • Optional: We can replace FormHelpMessage and Button with FormAlertWithSubmitButton. Like we do in AssigneeStep component.

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

    N/A

    What alternative solutions did you explore? (Optional)

    Result

  4. shawnborton commented on May 20, 2025

    @shawnborton
    Contributor

    cc @francoisl for visibility

  5. shawnborton commented on May 20, 2025

    @shawnborton
    Contributor

    And @allroundexperts - is this a regression from implementation?

  6. allroundexperts commented on May 20, 2025

    @allroundexperts
    Contributor

    Um... I am not sure @shawnborton. This was implemented quite some time ago and I jumped into this project at the end.

    Can I be assigned here?

  7. shawnborton commented on May 20, 2025

    @shawnborton
    Contributor

    Fine by me, but let's see what @alexpensify thinks.

  8. alexpensify commented on May 20, 2025

    @alexpensify
    Contributor

    To clarify, @allroundexperts, do you want to help with the review or write the PR to fix the issue?

  9. allroundexperts commented on May 20, 2025

    @allroundexperts
    Contributor

    I'll write the fix for this, but before that we need to confirm from @francoisl if this is a backend bug. Normally, every transaction has yourself as an attendee. In this case, it's not happening.

  10. francoisl commented on May 20, 2025

    @francoisl
    Contributor

    Ideally, when you create an expense and are the only attendee, we don't send any data for attendees in the API request.
    Put another way, "no attendees" means that you are the one and only attendee. Being the attendee of your expense is the default value, so we don't need to store that extra information.

    The changes I'd recommend are:

    • When we create any kind of money request:
      • If the user didn't interact with the attendee selector at all, just don't include any attendees in the API request
    • When we open the details of an expense:
      • If there are no attendee details in the expense details, select the current user

    We'll especially need the latter change to make expenses compatible with Expensify Classic, because we also don't store attendees by default when creating expenses on Classic.

  11. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on May 20, 2025
  12. 49 remaining items

  13. parasharrajat commented on Jun 23, 2025

    @parasharrajat
    Member

    Makes sense.

  14. trjExpensify commented on Jun 23, 2025

    @trjExpensify
    Contributor

    From the attendee tracking design doc, there was supposed to be a Recents section for previously selected attendees, and Contacts for everyone else (which will include any external attendees you add). I think that makes sense still.

    Image Image
  15. shawnborton commented on Jun 23, 2025

    @shawnborton
    Contributor
  16. allroundexperts commented on Jun 23, 2025

    @allroundexperts
    Contributor

    @parasharrajat I think we don't need to make any changes to my PR then?

  17. parasharrajat commented on Jun 24, 2025

    @parasharrajat
    Member

    It's fine to make the design look as above, but we still have that issue, so I guess we will move the current user details to the Contacts section as per the design doc.

    We will have to keep changes regarding the recent contacts section to show that section as per the design doc.

  18. melvin-bot commented on Jul 17, 2025

    @melvin-bot

    This issue has not been updated in over 15 days. @francoisl, @alexpensify, @parasharrajat, @allroundexperts eroding to Monthly issue.

    P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

  19. parasharrajat commented on Jul 17, 2025

    @parasharrajat
    Member

    PR of this issue #63729 was deployed to PROD 2 weeks back. This is ready for payment. @alexpensify

  20. parasharrajat commented on Jul 17, 2025

    @parasharrajat
    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: Attendee Tracking: Created AttendeeSelectionPage #48008 (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: Not needed

    • [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.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

    Regression Test Proposal

    Test:

    1. Open a submitted card expense as approver (viewing an expense with no attendees selected)
    2. Click the Attendees button
    3. Observe the RHN
    4. Verify that RBR is not displayed.

    Do we agree 👍 or 👎

  21. alexpensify commented on Jul 18, 2025

    @alexpensify
    Contributor

    Payment Summary

    Contributor: @allroundexperts due $250 via NewDot
    Contributor+: @parasharrajat due $250 via NewDot


    Please submit a request in Chat, thanks!

  22. parasharrajat commented on Jul 28, 2025

    @parasharrajat
    Member

    Payment requested as per #62325 (comment)

  23. twisterdotcom commented on Jul 31, 2025

    @twisterdotcom
    Contributor

    @parasharrajat has submitted payment for this report on ND here.

    SO: https://stackoverflowteams.com/c/expensify/questions/7582

    Zapier Logs Run ID: 00040eee-2a00-a51f-b33e-5afbf256b281
  24. trjExpensify commented on Jan 5, 2026

    @trjExpensify
    Contributor

    approved $250 for @allroundexperts.

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.InternalRequires API changes or must be handled by Expensify staffMonthlyKSv2ReviewingHas a PR in review

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions