Conversation
|
@jasperhuangg 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] |
| if (isLoadingApp) { | ||
| console.debug(`[OnyxUpdateManager] Ignoring Onyx updates while OpenApp hans't finished yet.`); | ||
| } | ||
| SequentialQueue.unpause(); |
There was a problem hiding this comment.
Please add a comment to explain why this needs to be here. Also, can you update the comment on line 44 above so that it also explains why updates shouldn't be processed in that situation?
| // When the OpenApp command hasn't finished yet, we should not process any updates. | ||
| // When value is set to null (which we do once we finish processing this method), we can just return early. | ||
| // Alternatively, if isLoadingApp is positive, that means that OpenApp command hasn't finished yet, so we | ||
| // should not process any updates that are being set. |
There was a problem hiding this comment.
This still doesn't quite make sense. I'll ask a couple of questions maybe and then that will help you craft a comment that answers the questions.
- Why should updates not be processed while OpenApp is pending? (Answer, I think: The base state of the app should be created before the first onyx updates are applied to it, or else there is a race condition where the first onyx updates get applied before the app is in its initial state and the first onyx updates are overwritten.)
There was a problem hiding this comment.
Agree, useful comments say why we do things, saying what we do is kind of implied by the code (but it's fine to explain it in the comment too)
| // should not process any updates that are being set. | ||
| if (!value || isLoadingApp) { | ||
| if (isLoadingApp) { | ||
| // Some of the places that set ONYX_UPDATES_FROM_SERVER also stop the sequential queue. If we reached |
There was a problem hiding this comment.
It is weird to see isLoadingApp in both if statements here. I think it would make the code more readable to turn this into two separate early returns. Then the comments might make more sense too.
There was a problem hiding this comment.
There are only three places in the code which set ONYX_UPDATES_FROM_SERVER.
- Two of them call
SequentialQueue.unpause();right after which is probably fine and good - This is the only one that doesn't... but it is also not pausing the queue anywhere close to it, so it doesn't appear like your comment is accurate.
Maybe a better solution is to put the SequentialQueue.unpause(); right after this just like the other occurrences? It would make more sense to put it there but I am not sure if it achieves the same result.
| */ | ||
| function saveUpdateInformation(updateParams: OnyxUpdatesFromServer) { | ||
| // Pause the Sequential queue so we don't do any other requests while we're fetching missing onyxUpdates | ||
| SequentialQueue.unpause(); |
There was a problem hiding this comment.
The comment says to pause the queue, but this is unpausing the queue 😓
There was a problem hiding this comment.
Wrong comment, should be written unpause.
| // we don't have base state of the app (reports, policies, etc) setup. If we apply this update, | ||
| // we'll only have them overriten by the openApp response. So let's skip it and return. | ||
| if (isLoadingApp) { | ||
| // When ONYX_UPDATES_LAST_UPDATE_ID_APPLIED_TO_CLIENT is set, we pause the queue. Let's unpause |
There was a problem hiding this comment.
Hm, I still can't see in the code where the queue is being paused where this is set.
| } | ||
| // If isLoadingApp is positive it means that OpenApp command hasn't finished yet, and in that case | ||
| // we don't have base state of the app (reports, policies, etc) setup. If we apply this update, | ||
| // we'll only have them overriten by the openApp response. So let's skip it and return. |
There was a problem hiding this comment.
That assumes that the data is coming in OpenApp, but it might not.
You can't be a reviewer because you pushed
Reviewer Checklist
Screenshots/VideosAndroid: mWeb Chrome |
|
✋ 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/tgolen in version: 1.4.63-0 🚀
|
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.4.63-21 🚀
|





Details
#39979 introduced a situation where the queue is never unpaused if you're logging in for the first time.
Fixed Issues
Related to #39380
Tests
./script/bwm.shsleep(10);to theOpenAppcommandOffline tests
None - it's required to be online to sign in
QA Steps
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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop