Skip to content

[PAY 6TH MARCH] iOS - Expense - No educational panel when an approver rejects an expense for the first time #81276

Closed

Description

@jponikarchuk

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: v9.3.11-24
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/folder/27754595/test-cases/77992811
Email or phone of affected tester (no customers): expensify416+da2@gmail.com
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: iPhone 12/ iOS 18
App Component: Money Requests

Action Performed:

Preconditions

  • Owner invites an approver and member to a workspace
  • Change the workspace approver from owner to the invited approver
  • Approver account has never rejected an expense before.
  • Submitter has submitted at least 3 expenses to the Approver
  1. Log in as an Approver who has never rejected an expense
  2. Open a submitted expense report
  3. Select an expense > "More" menu > Select "Reject"

Expected Result:

An educational panel (RHP) should appear explaining the difference between "Hold" and "Reject"

Actual Result:

No educational modal is displayed

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @Krishna2323

Activity

  1. added
    External
    Daily
    Bug
    on Feb 3, 2026
  2. added
    Help Wanted
    on Feb 3, 2026
  3. melvin-bot commented on Feb 3, 2026

    @melvin-bot

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

  4. melvin-bot commented on Feb 3, 2026

    @melvin-bot

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

  5. MobileMage commented on Feb 3, 2026

    @MobileMage
    Contributor

    Proposal

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

    On iOS, when an approver rejects an expense for the first time, the educational panel explaining Hold vs Reject doesn't appear. It works correctly on other platforms.

    What is the root cause of that problem?

    The HoldOrRejectEducationalModal component uses useBeforeRemove(onClose) which listens for navigation beforeRemove events and calls the onClose callback whenever one fires. On iOS, when the bottom-docked popover menu closes, the navigation state changes can trigger a beforeRemove event, which immediately calls onClose. This sets rejectModalAction to null and unmounts the modal before the InteractionManager.runAfterInteractions callback in FeatureTrainingModal has a chance to set isModalVisible = true.

    const illustrations = useMemoizedLazyIllustrations(['Stopwatch', 'Rules', 'RealtimeReport', 'ThumbsDown', 'ModalHoldOrReject']);
    useBeforeRemove(onClose);

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

    Remove the useBeforeRemove hook from HoldOrRejectEducationalModal. This hook was intended to handle navigation cleanup, but since the modal passes shouldGoBack={false} to FeatureTrainingModal, it doesn't need navigation-based dismissal. The modal's own onClose handler (passed via props) already handles proper cleanup when the user confirms or dismisses the modal via its UI controls.

     function HoldOrRejectEducationalModal({onClose, onConfirm}: HoldOrRejectEducationalModalProps) {
         const {translate} = useLocalize();
         const styles = useThemeStyles();
         const illustrations = useMemoizedLazyIllustrations(['Stopwatch', 'Rules', 'RealtimeReport', 'ThumbsDown', 'ModalHoldOrReject']);
    
    -    useBeforeRemove(onClose);
    -
         const menuSections: SectionMenuItem[] = [

    What alternative solutions did you explore? (Optional)

    N/A

  6. TaduJR commented on Feb 3, 2026

    @TaduJR
    Contributor

    Proposal

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

    On iOS, when an approver who has never rejected an expense selects "Reject" from the More menu on an expense, the educational panel (RHP) explaining the difference between "Hold" and "Reject" does not appear.

    What is the root cause of that problem?

    The FeatureTrainingModal component uses InteractionManager.runAfterInteractions() to set modal visibility, which can fail to execute or be delayed indefinitely on iOS when there are pending interactions from previous modal animations.

    Root Cause Flow:

    1. User clicks "Reject" from the dropdown menu

      if (dismissedRejectUseExplanation) {
      if (parentReportAction) {
      rejectMoneyRequestReason(parentReportAction);
      }
      } else {
      setRejectModalAction(CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.REJECT);

    2. PopoverMenu schedules callback via close() with shouldCallAfterModalHide: true

      shouldCallAfterModalHide: true,

    3. After popover closes, setRejectModalAction() triggers HoldOrRejectEducationalModal render

      {!!rejectModalAction && (
      <HoldOrRejectEducationalModal
      onClose={dismissRejectModalBasedOnAction}
      onConfirm={dismissRejectModalBasedOnAction}
      />
      )}

    4. FeatureTrainingModal mounts and uses InteractionManager.runAfterInteractions() to show modal

      useEffect(() => {
      // eslint-disable-next-line @typescript-eslint/no-deprecated
      InteractionManager.runAfterInteractions(() => {
      if (!isModalDisabled) {
      setIsModalVisible(false);
      return;
      }
      setIsModalVisible(true);
      });
      }, [isModalDisabled]);

    On iOS, the InteractionManager queue gets stuck because the popover close animation leaves pending interactions. This is a known issue - the codebase has been systematically removing InteractionManager usage (e.g., PRs #75409, #76586, #75381).

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

    Remove the InteractionManager.runAfterInteractions() wrapper in FeatureTrainingModal and set modal visibility directly based on the isModalDisabled prop.

    File: src/components/FeatureTrainingModal.tsx

    useEffect(() => {
    // eslint-disable-next-line @typescript-eslint/no-deprecated
    InteractionManager.runAfterInteractions(() => {
    if (!isModalDisabled) {
    setIsModalVisible(false);
    return;
    }
    setIsModalVisible(true);
    });
    }, [isModalDisabled]);

    Change:

    - useEffect(() => {
    -     // eslint-disable-next-line @typescript-eslint/no-deprecated
    -     InteractionManager.runAfterInteractions(() => {
    -         if (!isModalDisabled) {
    -             setIsModalVisible(false);
    -             return;
    -         }
    -         setIsModalVisible(true);
    -     });
    - }, [isModalDisabled]);
    + useEffect(() => {
    +     setIsModalVisible(isModalDisabled);
    + }, [isModalDisabled]);

    Also remove the unused InteractionManager import from line 4:

    import {Image, InteractionManager, View} from 'react-native';

    - import {Image, InteractionManager, View} from 'react-native';
    + import {Image, View} from 'react-native';

    What alternative solutions did you explore? (Optional)

    1. Use requestAnimationFrame - We Could also replace InteractionManager with requestAnimationFrame
    2. Use queueMicrotask - Similar to the pattern used in other parts of the codebase when removing InteractionManager
  7. twinkle-react commented on Feb 3, 2026

    @twinkle-react

    Proposal

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

    An approver who has never rejected an expense does not see the Hold/Reject educational panel when they select Reject, either single or bulk, on iOS, and the reject action continues without showing the required educational help.

    What is the root cause of that problem?

    In this flow, the earliest incorrect assumption is that setting header-local state to trigger the educational modal is reliable. In src/components/MoneyReportHeader.tsx, the logic assumes the header will stay mounted long enough to render the modal after setRejectModalAction is called, but on iOS the native menu close or navigation can unmount the header first, so the modal never appears and the invariant is broken.

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

    Apply the smallest shared-layer fix by moving modal presentation to the global modal stack owned by ModalProvider. Add a small shared hook that always shows the Hold/Reject educational modal through showModal, and update all reject entry points to use this hook instead of header-local state.

    Files changed include one new hook and three small call-site updates.

    New file: src/hooks/useHoldRejectEducationalModal.tsx

    import {useCallback, useRef} from 'react';
    import {useModal, ModalActions} from '@components/Modal/Global/ModalContext';
    import HoldOrRejectEducationalModal from '@components/HoldOrRejectEducationalModal';
    import Log from '@libs/Log';
    
    const MODAL_ID = 'hold-or-reject-educational-modal';
    
    export default function useHoldRejectEducationalModal() {
        const {showModal} = useModal();
        const isShowingRef = useRef(false);
    
        return useCallback(
            async (onConfirm?: () => void) => {
                if (isShowingRef.current) {
                    return;
                }
    
                isShowingRef.current = true;
                Log.info('HoldRejectEdu:shown');
    
                try {
                    const result = await showModal({
                        component: HoldOrRejectEducationalModal,
                        props: {
                            onClose: () => {},
                            onConfirm: () => {},
                        },
                        id: MODAL_ID,
                        isCloseable: true,
                    });
    
                    if (result?.action === ModalActions.CONFIRM) {
                        Log.info('HoldRejectEdu:confirmed');
                        onConfirm?.();
                    }
                } finally {
                    isShowingRef.current = false;
                }
            },
            [showModal],
        );
    }

    Modify src/components/MoneyReportHeader.tsx

    Add the import and initialize the hook.

    import useHoldRejectEducationalModal from '@hooks/useHoldRejectEducationalModal';
    const showHoldRejectEducationalModal = useHoldRejectEducationalModal();

    Replace the existing function with a compatible version that accepts an optional action.

    const dismissRejectModalBasedOnAction = (
        actionParam?: ValueOf<
            typeof CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.HOLD |
            typeof CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.REJECT |
            typeof CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.REJECT_BULK
        >,
    ) => {
        const actionToUse = actionParam ?? rejectModalAction;
    
        if (actionToUse === CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.HOLD) {
            dismissRejectUseExplanation();
            if (requestParentReportAction) {
                changeMoneyRequestHoldStatus(requestParentReportAction);
            }
        } else if (actionToUse === CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.REJECT_BULK) {
            dismissRejectUseExplanation();
            if (moneyRequestReport?.reportID) {
                Navigation.navigate(
                    ROUTES.SEARCH_MONEY_REQUEST_REPORT_REJECT_TRANSACTIONS.getRoute({
                        reportID: moneyRequestReport.reportID,
                    }),
                );
            }
        } else {
            dismissRejectUseExplanation();
            if (requestParentReportAction) {
                rejectMoneyRequestReason(requestParentReportAction);
            }
        }
    
        setRejectModalAction(null);
    };

    Replace all setRejectModalAction(...) usages.

    showHoldRejectEducationalModal(() =>
        dismissRejectModalBasedOnAction(CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.REJECT),
    );
    showHoldRejectEducationalModal(() =>
        dismissRejectModalBasedOnAction(CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.REJECT_BULK),
    );
    showHoldRejectEducationalModal(() =>
        dismissRejectModalBasedOnAction(CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.HOLD),
    );

    Modify src/components/MoneyRequestHeader.tsx

    Add the import and initialize the hook.

    import useHoldRejectEducationalModal from '@hooks/useHoldRejectEducationalModal';
    const showHoldRejectEducationalModal = useHoldRejectEducationalModal();

    Replace the reject call site.

    showHoldRejectEducationalModal(() =>
        dismissRejectModalBasedOnAction(CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.REJECT),
    );

    Modify src/pages/Search/SearchPage.tsx

    Add the import and initialize the hook.

    import useHoldRejectEducationalModal from '@hooks/useHoldRejectEducationalModal';
    const showHoldRejectEducationalModal = useHoldRejectEducationalModal();

    Replace the bulk reject path when the explanation is not dismissed.

    showHoldRejectEducationalModal(() =>
        dismissRejectModalBasedOnAction(CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.REJECT),
    );

    What alternative solutions did you explore? (Optional)

    None

  8. truph01 commented on Feb 3, 2026

    @truph01
    Contributor

    Proposal

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

    • The educational modal is not displayed when rejecting transactions.

    What is the root cause of that problem?

    • On narrow screens, the reject button is rendered under the “selected” actions menu, but this flow does not handle the “first-time reject” case where the educational modal should be shown.

    • On large screens, this logic is already implemented and works as expected:

      options={selectedTransactionsOptions}

      const selectedTransactionsOptions = useMemo(() => {
      return originalSelectedTransactionsOptions.map((option) => {
      if (option.value === CONST.REPORT.SECONDARY_ACTIONS.DELETE) {
      return {
      ...option,
      onSelected: showDeleteModal,
      };
      }
      if (option.value === CONST.REPORT.SECONDARY_ACTIONS.REJECT) {
      return {
      ...option,
      onSelected: () => {
      if (dismissedRejectUseExplanation) {
      option.onSelected?.();
      } else {
      setRejectModalAction(CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.REJECT_BULK);
      }
      },
      };
      }
      return option;
      });
      }, [originalSelectedTransactionsOptions, showDeleteModal, dismissedRejectUseExplanation]);

    As a result, behavior is inconsistent between narrow and large screen layouts.

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

    • We should align the narrow screen behavior with the large screen implementation.

    1. Update selected transaction options

    options: originalSelectedTransactionsOptions,
    • Then introduce state, Onyx values, and derived options to intercept the reject action and conditionally show the educational modal:
    const [dismissedRejectUseExplanation] = useOnyx(
        ONYXKEYS.NVP_DISMISSED_REJECT_USE_EXPLANATION,
        {canBeMissing: true}
    );
    
    const [rejectModalAction, setRejectModalAction] = useState<
        ValueOf<typeof CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.REJECT_BULK> | null
    >(null);
    
    const selectedTransactionsOptions = useMemo(() => {
        return originalSelectedTransactionsOptions.map((option) => {
            if (option.value === CONST.REPORT.SECONDARY_ACTIONS.REJECT) {
                return {
                    ...option,
                    onSelected: () => {
                        if (dismissedRejectUseExplanation) {
                            option.onSelected?.();
                        } else {
                            setRejectModalAction(CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.REJECT_BULK);
                        }
                    },
                };
            }
            return option;
        });
    }, [originalSelectedTransactionsOptions, dismissedRejectUseExplanation]);
    
    const dismissRejectModalBasedOnAction = useCallback(() => {
        if (rejectModalAction === CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.REJECT_BULK) {
            dismissRejectUseExplanation();
            if (report?.reportID) {
                Navigation.navigate(
                    ROUTES.SEARCH_MONEY_REQUEST_REPORT_REJECT_TRANSACTIONS.getRoute({reportID: report.reportID})
                );
            }
        }
        setRejectModalAction(null);
    }, [rejectModalAction, report?.reportID]);

    2. Render the educational modal

    {!!rejectModalAction && (
        <HoldOrRejectEducationalModal
            onClose={dismissRejectModalBasedOnAction}
            onConfirm={dismissRejectModalBasedOnAction}
        />
    )}

    This mirrors the large screen behavior and ensures the educational modal is shown consistently across screen sizes.

    What alternative solutions did you explore? (Optional)

    • We can handle hold action as well.
  9. Krishna2323 commented on Feb 7, 2026

    @Krishna2323
    Contributor

    @truph01’s proposal looks good to me. The root cause is correct — we don’t handle showing the modal in MoneyRequestReportActionsList the same way we do in MoneyReportHeader and MoneyRequestHeader.

    🎀 👀 🎀
    C+ Reviewed

  10. 9 remaining items

  11. added
    Weekly
    and removed
    Daily
    on Feb 13, 2026
  12. truph01 commented on Feb 13, 2026

    @truph01
    Contributor

    @Krishna2323 PR is ready

  13. Krishna2323 commented on Mar 3, 2026

    @Krishna2323
    Contributor

    BugZero Checklist:

    • [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: Hold and Reject Role based Modal updates #74505 (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:

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

    Precondition:

    • Log in as an Approver who has never rejected an expense

    Test:

    1. Open a submitted expense report
    2. Select an expense > "More" menu > Select "Reject"
    3. Verify: An educational panel (RHP) should appear explaining the difference between "Hold" and "Reject"

    Do we agree 👍 or 👎

  14. jliexpensify commented on Mar 3, 2026

    @jliexpensify
    Contributor

    I think this was deployed to prod 4 days ago, correct?

  15. Krishna2323 commented on Mar 3, 2026

    @Krishna2323
    Contributor
  16. changed the title [-]iOS - Expense - No educational panel when an approver rejects an expense for the first time[/-] [+][PAY 6TH MARCH] iOS - Expense - No educational panel when an approver rejects an expense for the first time[/+] on Mar 3, 2026
  17. jliexpensify commented on Mar 3, 2026

    @jliexpensify
    Contributor

    Payment Summary

    • C: @truph01 $250 (to be paid via New Expensify requests)
    • C+: @Krishna2323 $250 (to be paid via New Expensify requests)
  18. JmillsExpensify commented on Mar 18, 2026

    @JmillsExpensify
    Contributor

    $250 approved for @truph01

  19. Krishna2323 commented on Apr 4, 2026

    @Krishna2323
    Contributor

    Requested in ND.

  20. twisterdotcom commented on Apr 5, 2026

    @twisterdotcom
    Contributor

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

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

    Zapier Logs Run ID: 00040eee-70a9-a077-914f-a8cfff5af0f4
  21. quinthar commented on Apr 13, 2026

    @quinthar
    Contributor

    Approved $250 to @Krishna2323

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

Metadata

Metadata

Labels

BugExternalReviewingWeekly

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions