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.53k stars 2.88k forks source link

Distance - After tapping split expense with amount button, briefly "split expense" button shown #52196

Open IuliiaHerets opened 3 hours ago

IuliiaHerets commented 3 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: 5.0.49-0 Reproducible in staging?: Y Reproducible in production?: Y Issue reported by: Applause Internal Team

Action Performed:

  1. Go to https://staging.new.expensify.com/home
  2. Open a room chat with few members invited
  3. Tap plus icon left to chat input
  4. Tap split expense - distance
  5. Enter start and stop points
  6. Tap next
  7. Note tap split expense with amount button displayed
  8. Tap on it

Expected Result:

After tapping split expense with amount button, briefly "split expense" button must not be shown before showing conversation page.

Actual Result:

After tapping split expense with amount button, briefly "split expense" button is shown before showing conversation page.

Workaround:

Unknown

Platforms:

Screenshots/Videos

https://github.com/user-attachments/assets/374688a8-ad09-4217-bd6c-47f5a95ad8ed

View all open jobs on GitHub

melvin-bot[bot] commented 3 hours ago

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.

FitseTLT commented 2 hours ago

Edited by proposal-police: This proposal was edited at 2024-11-07 16:12:46 UTC.

Proposal

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

Distance - After tapping split expense with amount button, briefly "split expense" button shown

What is the root cause of that problem?

We reset the draft transaction on creating the expense and we show the split expense button if the iouAmount is 0 https://github.com/Expensify/App/blob/8a83e2baa1c7ce7ee2c31103574937c0484854be/src/components/MoneyRequestConfirmationList.tsx#L414-L415 so as the draft transaction amount is not available (0) it will show 'split expense'

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

We can remove the draft transaction clearing code every where we are clearing it now like here https://github.com/Expensify/App/blob/8a83e2baa1c7ce7ee2c31103574937c0484854be/src/libs/actions/IOU.ts#L4134-L4136 here here here Because we are already clearing the draft transaction in startMoneyRequest https://github.com/Expensify/App/blob/8a83e2baa1c7ce7ee2c31103574937c0484854be/src/libs/actions/IOU.ts#L392-L393 We can apply the change for our split case related to the current issue but I think it is better to apply it globally.

What alternative solutions did you explore? (Optional)

Alternatively we can use TransactionEdit.removeDraftTransaction with runAfterInteraction here https://github.com/Expensify/App/blob/8a83e2baa1c7ce7ee2c31103574937c0484854be/src/pages/iou/request/step/IOURequestStepConfirmation.tsx#L377

            InteractionManager.runAfterInteractions(() => removeDraftTransaction(CONST.IOU.OPTIMISTIC_TRANSACTION_ID));

If we feel unsafe clearing the draft transaction before the create request actions have been called ( as we need the draft transaction value inside the functions) we can call it after the createTransaction function calls