Skip to content

[Due for payment 2025-09-02] [HOLD https://github.com/Expensify/App/issues/69171] [$250] Delegate Confirmation Modal Lacks Exit Animation #65576

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: 9.1.77-1
Reproducible in staging?: Y
Reproducible in production?: Y
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: @Eskalifer1
Slack conversation (hyperlinked to channel name): #Open source

Action Performed:

  1. Navigate to the Security page
  2. Click on "Add Copilot"
  3. Proceed through the flow until you receive the magic code
  4. Attempt to close the modal window by clicking outside the modal

Expected Result:

The modal should close smoothly, consistent with the standard animation used across the platform.

Actual Result:

The modal window has no animation and disappears only after another page is rendered

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
2025-07-07.09.42.11.mov
Recording.1385.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021942705427324771030
  • Upwork Job ID: 1942705427324771030
  • Last Price Increase: 2025-08-12
Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

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

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (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. Eskalifer1 commented on Jul 7, 2025

    @Eskalifer1
    Contributor

    Proposal

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

    The Delegate confirm modal window does not have a disappearing animation

    What is the root cause of that problem?

    The problem is in the use of this hook:

    const [isValidateCodeActionModalVisible, setIsValidateCodeActionModalVisible] = useCustomHistoryParam();

    Before leaving the page, we change the display state of the modal window to false:

    useBeforeRemove(() => setIsValidateCodeActionModalVisible(false));

    But the useCustomHistoryParam hook

    function useCustomHistoryParam() {
    const navigation = useNavigation();
    const route = useRoute();
    const historyParamName = SCREEN_TO_HISTORY_PARAM[route.name as Screen];
    if (!historyParamName || typeof historyParamName !== 'string') {
    throw new Error(`Screen ${route.name} does not have a history param. You can use this hook only on the screens that have one defined in SCREEN_TO_HISTORY_PARAM.`);
    }
    const historyParam = route.params && (route.params as Record<string, unknown>)[historyParamName] ? ((route.params as Record<string, unknown>)[historyParamName] as boolean) : false;
    if (typeof historyParam !== 'boolean') {
    throw new Error(`The history param ${historyParamName} is not a boolean. Make sure that you used getHistoryParamParse for this screen in linkingConfig/config.ts`);
    }
    return [
    historyParam,
    (value: boolean) => {
    navigation.dispatch({
    type: CONST.NAVIGATION.ACTION_TYPE.SET_HISTORY_PARAM,
    payload: {key: historyParamName, value},
    });
    },
    ] as const;
    }

    is not reactive, so navigation.dispatch will not trigger the update of the component, which is why the state will not be updated, which is why the modal window will not close

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

    We need to make this hook reactive, for this it must have a state, I propose to add a state and its recovery to the hook

    This is how it will look like:

    function useCustomHistoryParam() {
      const navigation = useNavigation();
      const route = useRoute();
      const historyParamName = SCREEN_TO_HISTORY_PARAM[route.name as Screen];
    
      const getParamValue = useCallback(() => {
        const paramValue =
          route.params && historyParamName && (route.params as Record<string, unknown>)[historyParamName]
            ? ((route.params as Record<string, unknown>)[historyParamName] as boolean)
            : false;
    
        if (typeof paramValue !== 'boolean') {
          throw new Error(`The history param ${historyParamName} is not a boolean. Make sure that you used getHistoryParamParse for this screen in linkingConfig/config.ts`);
        }
    
        return paramValue;
      }, [route.params, historyParamName]);
    
      const [historyParam, setHistoryParamState] = useState(getParamValue);
    
      if (!historyParamName || typeof historyParamName !== 'string') {
        throw new Error(`Screen ${route.name} does not have a history param. You can use this hook only on the screens that have one defined in SCREEN_TO_HISTORY_PARAM.`);
      }
    
      useEffect(() => {
        setHistoryParamState(getParamValue());
      }, [route.params, historyParamName]);
    
      const setHistoryParam = (value: boolean) => {
        navigation.dispatch({
          type: CONST.NAVIGATION.ACTION_TYPE.SET_HISTORY_PARAM,
          payload: {key: historyParamName, value},
        });
        setHistoryParamState(value);
      };
    
      return [historyParam, setHistoryParam] as const;
    }

    PS: Minor changes and other things can be discussed during the PR stage

    I also propose to create a hook that we will use for modal windows, it will be a wrapper on top of the usual useState, but it will also have onBeforeRemove(() => setIsModalVisible(false))

    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)

    Add a local state for the page

    function ConfirmDelegatePage({route}: ConfirmDelegatePageProps) {

    Which would be responsible for displaying the modal window, but would also leave the useCustomHistoryParam hook for the logic
    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.

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jul 8, 2025
  5. changed the title [-]Delegate Confirmation Modal Lacks Exit Animation[/-] [+][$250] Delegate Confirmation Modal Lacks Exit Animation[/+] on Jul 8, 2025
  6. melvin-bot commented on Jul 8, 2025

    @melvin-bot
  7. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jul 8, 2025
  8. melvin-bot commented on Jul 8, 2025

    @melvin-bot

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

  9. mallenexpensify commented on Jul 8, 2025

    @mallenexpensify
    Contributor

    @fedirjh 👀 on @Eskalifer1 's proposal above plz. Please review the Slack thread too please, inc.

    lets make sure to ask to fix All the modals and see who to ensure no single modal like this is omitted in future

  10. truph01 commented on Jul 10, 2025

    @truph01
    Contributor

    Proposal

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

    • The modal window currently has no exit animation and only disappears after the next page finishes rendering.

    What is the root cause of that problem?

    This attempts to set the modal's visibility to false. However, unlike other pages where the visibility state is updated immediately (via a simple useState setter), in this case, setting the modal visibility triggers a navigation action:

    (value: boolean) => {
    navigation.dispatch({
    type: CONST.NAVIGATION.ACTION_TYPE.SET_HISTORY_PARAM,
    payload: {key: historyParamName, value},
    });
    },

    This navigation introduces a delay before the modal’s state reflects the updated value. Specifically, the isValidateCodeActionModalVisible value here:

    const [isValidateCodeActionModalVisible, setIsValidateCodeActionModalVisible] = useCustomHistoryParam();

    requires time to update.

    • As a result, when the right-hand panel (RHP) is closed, the modal remains visible until the navigation completes. It then disappears abruptly without an exit animation.

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

    We can modify the component as follows to immediately hide the modal when the beforeRemove event is triggered.

    At:

    useBeforeRemove(() => setIsValidateCodeActionModalVisible(false));

    Update to:

    
    const [isRemoving, setIsRemoving] = useState(false);
    useBeforeRemove(() => {
        setIsRemoving(true);
        setIsValidateCodeActionModalVisible(false);
    });
    

    Then, at:

    isValidateCodeActionModalVisible={isValidateCodeActionModalVisible}

    Update the modal’s visibility check:

    
    isValidateCodeActionModalVisible={isValidateCodeActionModalVisible && !isRemoving}
    

    This approach ensures the modal is hidden immediately during the beforeRemove phase, allowing a smoother exit experience without abrupt disappearance.

    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)

  11. melvin-bot commented on Jul 14, 2025

    @melvin-bot

    @fedirjh Eep! 4 days overdue now. Issues have feelings too...

  12. 66 remaining items

  13. changed the title [-][HOLD https://github.com/Expensify/App/issues/69171] [$250] Delegate Confirmation Modal Lacks Exit Animation[/-] [+][Due for payment 2025-09-02] [HOLD https://github.com/Expensify/App/issues/69171] [$250] Delegate Confirmation Modal Lacks Exit Animation[/+] on Aug 26, 2025
  14. melvin-bot commented on Aug 26, 2025

    @melvin-bot

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

  15. melvin-bot commented on Aug 26, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.98-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-09-02. 🎊

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

    • @fedirjh requires payment through NewDot Manual Requests
  16. melvin-bot commented on Aug 26, 2025

    @melvin-bot

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

  17. melvin-bot commented on Sep 2, 2025

    @melvin-bot

    Skipping the payment summary for this issue since all the assignees are employees or vendors. If this is incorrect, please manually add the payment summary SO.

  18. mallenexpensify commented on Sep 4, 2025

    @mallenexpensify
    Contributor

    @fedirjh are you due compensation here? Looked at a couple PRs and wasn't sure.

  19. fedirjh commented on Sep 4, 2025

    @fedirjh
    Contributor

    are you due compensation here?

    Hey @mallenexpensify No payment is due here. Thank you.

  20. mallenexpensify commented on Sep 5, 2025

    @mallenexpensify
    Contributor

    I'm assuming payment isn't due for anyone and that we don't need a regression test (partially cuz the PR has two issues linked in the OP, also cuz it was on hold pending the other issue). Comment/reopen if anyone disagree!

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