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
2.99k stars 2.5k forks source link

Fix getContinuousReportActionChain with optimistic actions #41644

Closed janicduplessis closed 1 week ago

janicduplessis commented 2 weeks ago

Details

We previously only checked for optimistic actions at the start of the chat, but they can actually be anywhere. This makes sure that we do not consider them when building the continuous action chain since the backend does not know of them and previousReportActionID will be wrong.

If the result of getContinuousReportActionChain is wrong it will cause the same reportActionID to be sent to GetOlderActions and cause this loading loop.

Before

We incorrectly detect a gap in the actions list and return only the first action. Because of this we never detect that we are at the end of the chat and stop calling GetOlderActions.

The first array is sortedAllReportActions and the 2nd is reportActions which is the result of calling getContinuousReportActionChain.

image

After

We properly skip over the optimistic action and return the full chat. This causes GetOlderActions to stop being called since we have the CREATED action.

image

Fixed Issues

$ https://github.com/Expensify/App/issues/41573 PROPOSAL: https://github.com/Expensify/App/issues/41573#issuecomment-2094317349

Tests

Offline tests

QA Steps

PR Author Checklist

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native ![image](https://github.com/Expensify/App/assets/2677334/15e08416-3d55-42e8-b64f-8d9555af5be9)
iOS: mWeb Safari
MacOS: Chrome / Safari image
MacOS: Desktop
melvin-bot[bot] commented 2 weeks ago

@parasharrajat Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

github-actions[bot] commented 1 week ago
:test_tube::test_tube: Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! :test_tube::test_tube: Android :robot: iOS :apple:
https://ad-hoc-expensify-cash.s3.amazonaws.com/android/41644/index.html https://ad-hoc-expensify-cash.s3.amazonaws.com/ios/41644/index.html
Android iOS
Desktop :computer: Web :spider_web:
https://ad-hoc-expensify-cash.s3.amazonaws.com/desktop/41644/NewExpensify.dmg https://41644.pr-testing.expensify.com
Desktop Web

:eyes: View the workflow run that generated this build :eyes:

marcaaron commented 1 week ago

@parasharrajat can we get an ETA on the review for this?

roryabraham commented 1 week ago

Had to merge main to get this fix, but that's on staging already. This tests well and makes sense

roryabraham commented 1 week ago

Reviewer Checklist

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari https://github.com/Expensify/App/assets/47436092/8f7699ae-98cd-4c31-b64a-612705b4f16f
MacOS: Desktop
OSBotify commented 1 week ago

🚀 Deployed to production by https://github.com/marcaaron in version: 1.4.70-5 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅