Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.49k stars 2.84k forks source link

[$250] Copilot - Nothing happens when clicking Add copilot after returning from magic code page #51273

Open IuliiaHerets opened 2 hours ago

IuliiaHerets commented 2 hours ago

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.0.52-2 Reproducible in staging?: Y Reproducible in production?: N Email or phone of affected tester (no customers): applausetester+kh081006@applause.expensifail.com Issue reported by: Applause Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to Account settings > Security.
  3. Click Add copilot.
  4. Select a user > Next.
  5. Select an access level > Next.
  6. Click Add copilot.
  7. Click RHP back button.
  8. Click Add copilot.

Expected Result:

App will proceed to magic code page.

Actual Result:

Nothing happens when clicking Add copilot after returning from magic code page.

Workaround:

Unknown

Platforms:

Screenshots/Videos

https://github.com/user-attachments/assets/7b90164b-197d-420f-a400-1a6e477af767

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021848771830019077606
  • Upwork Job ID: 1848771830019077606
  • Last Price Increase: 2024-10-22
Issue OwnerCurrent Issue Owner: @jayeshmangwani
melvin-bot[bot] commented 2 hours ago

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

melvin-bot[bot] commented 2 hours ago

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

melvin-bot[bot] commented 2 hours ago

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

github-actions[bot] commented 2 hours ago

:wave: 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.
melvin-bot[bot] commented 2 hours ago

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

carlosmiceli commented 2 hours ago

A bit of an edge case, can probably be solved quickly so will ask for help from contributors.

melvin-bot[bot] commented 2 hours ago

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

mkzie2 commented 2 hours ago

Proposal

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

Nothing happens when clicking Add copilot after returning from magic code page.

What is the root cause of that problem?

We already setIsValidateCodeActionModalVisible(true) when pressing Add copilot. But when we close the validate code modal, we did not reset the isValidateCodeActionModalVisible so when pressing Add copilot again, setIsValidateCodeActionModalVisible(true) is triggered causing no state changes >> not toggle the modal again.

https://github.com/Expensify/App/blob/592343f85f984723f12d3b326d1304a9e183dccb/src/pages/settings/Security/AddDelegate/ConfirmDelegatePage.tsx#L47

https://github.com/Expensify/App/blob/592343f85f984723f12d3b326d1304a9e183dccb/src/pages/settings/Security/AddDelegate/ConfirmDelegatePage.tsx#L76-L77

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

Reset isValidateCodeActionModalVisible to false when we navigate back/close the validate code modal.

Introduce onClose prop to DelegateMagicCodeModal and pass from ConfirmDelegatePage:

<DelegateMagicCodeModal
    onClose={() => setIsValidateCodeActionModalVisible(false)}

And pass to ValidateCodeActionModal from DelegateMagicCodeModal.

cretadn22 commented 2 hours ago

Edited by proposal-police: This proposal was edited at 2024-10-22 17:13:44 UTC.

Proposal

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

Nothing happens when clicking Add copilot after returning from magic code page

What is the root cause of that problem?

We have two isValidateCodeActionModalVisible in DelegateMagicCodeModal and ConfirmDelegatePage. When we navigate back we don't update isValidateCodeActionModalVisible in ConfirmDelegatePage to false

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

Let's remove isValidateCodeActionModalVisible in DelegateMagicCodeModal. Remove this line https://github.com/Expensify/App/blob/592343f85f984723f12d3b326d1304a9e183dccb/src/pages/settings/Security/AddDelegate/DelegateMagicCodeModal.tsx#L22

We only should use one isValidateCodeActionModalVisible state on ConfirmDelegatePage in two places. To do that, we need to pass isValidateCodeActionModalVisible and setIsValidateCodeActionModalVisible from ConfirmDelegatePage https://github.com/Expensify/App/blob/592343f85f984723f12d3b326d1304a9e183dccb/src/pages/settings/Security/AddDelegate/ConfirmDelegatePage.tsx#L77

                    isValidateCodeActionModalVisible={isValidateCodeActionModalVisible}
                    setIsValidateCodeActionModalVisible={setIsValidateCodeActionModalVisible}

And use two props on DelegateMagicCodeModal

What alternative solutions did you explore? (Optional)

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.

jayeshmangwani commented 1 hour ago

I agree with you proposal @cretadn22. Right now, we have two different state that do the same thing but on different pages, so I think we should handle the hide/show logic from the parent component (ConfirmDelegatePage)

@cretadn22 , could you please check why we're rendering the DelegateMagicCodeModal modal conditionally with the isValidateCodeActionModalVisible check? Is it necessary, or can we simplify it?

https://github.com/Expensify/App/blob/f5352807828cf5f63c311c597bac2c0065aded2c/src/pages/settings/Security/AddDelegate/ConfirmDelegatePage.tsx#L76-L79