fix: apply optimistic updates from READ requests immediately#48057
fix: apply optimistic updates from READ requests immediately#48057roryabraham merged 1 commit intoExpensify:mainfrom
Conversation
|
@mananjadhav 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] |
|
cc @roryabraham I still need to run all tests from the previous PRs to make sure we don't break anything. // Edit: I tested as much as I could, wasn't able to find any issues. Are there any other flows that come you've in mind how I could try to provoke it to regress into any issues? |
|
Will be reviewing this in a few hours. |
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / Safariweb-optimistic-data.movMacOS: Desktopdesktop-optimistic-data.mov |
|
Okay so I am trying to test this on iOS and mobile web. I disconnected the Wifi and connected again but I do see the old value of tag being shown temporarily. ios-optimistic-flicker.movmweb-chrome-optimistic-flicker.mov |
|
Hm okay, thats odd, will take a look! |
|
Note: I am OOO until Wednesday, will pick up after. (Or @kirillzyusko if you have time meanwhile feel free to take a look!) |
|
@hannojg @kirillzyusko Any updates on this one? |
|
@mananjadhav I'm looking into it 👀 |
7a19148 to
c52bc36
Compare
|
@mananjadhav I've tested the code (before and after modifications) and I see the behavior that you described in old code variant as well: Untitled-23.movSo it makes me thinking that you found another bug that present in both code versions and I think it's better to fix it in separate PR and open a new issue. What do you think? The purpose of this PR was to fix an order of applying optimistic update (in case if we have write operations in queue) - and this PR its job well. The only thing is that you found a new bug, but I believe this bug present in current |
|
@kirillzyusko Isn't one of the test steps about not flickering between old and new value.
|
|
@mananjadhav Yes its one of the test steps I wrote. However I was assuming that "there is no flickering / jumping of the old and new value" on the I should probably update the tests steps accordingly and open a new issue, right? // Edit: Started a bug report flow here |
|
Yeah @hannojg please update the test steps accordingly for me to test and verify. I can see you've started the bug report flow already. Thank you. |
@hannojg @kirillzyusko quick bump |
|
@hannojg quick bump. @roryabraham do you have any test steps in mind? Or should I submit the checklist with the flicker knowing it exists on main? |
|
Not sure about specific test steps here, but I'm not too worried about it because this is how it used to work, and I only changed it accidentally/by mistake. |
|
Going to just merge this because I am pretty sure it's right, I don't know what specific test steps would be needed anyways, and you did some basic smoke tests already. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/roryabraham in version: 9.0.44-0 🚀
|
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.0.44-12 🚀
|
Details
In our API layer and the sequential queue we want to run READ requests after WRITE requests. This is to avoid a READ request overwriting optimistic data of a write request. This was introduced here:
API.readwait on all requests on the SequentialQueue to respond #12219However, this currently prevents the optimistic updates of a READ request to be applied right away. This leads to bugs where components call READ commands but those don't update the onyx state right away.
Fixed Issues
$ #48053
PROPOSAL: https://expensify.slack.com/archives/C05LX9D6E07/p1724701548092719?thread_ts=1724696592.356379&cid=C05LX9D6E07
Tests
Offline tests
Same as tests
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Screen_Recording_20240827_104150_New.Expensify.Dev.mp4
Android: mWeb Chrome
Screen.Recording.2024-08-27.at.09.52.34.mov
iOS: Native
ios-native.mov
iOS: mWeb Safari
Screen.Recording.2024-08-27.at.09.47.07.mov
MacOS: Chrome / Safari
Screen.Recording.2024-08-27.at.09.37.11.mov
MacOS: Desktop
Screen.Recording.2024-08-27.at.10.55.41.mov