Fix auth token issues after switching account and handle missing isLoadingApp#80073
Fix auth token issues after switching account and handle missing isLoadingApp#80073mountiny merged 5 commits intoExpensify:mainfrom
Conversation
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b1457ebf57
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const [hasLoadedApp] = useOnyx(ONYXKEYS.HAS_LOADED_APP, {canBeMissing: true}); | ||
| const [isLoadingApp] = useOnyx(ONYXKEYS.IS_LOADING_APP, {canBeMissing: true}); | ||
| const {isOffline} = useNetwork(); |
There was a problem hiding this comment.
I am concerned this might cause performance regression. Need to test thoroughly.
i.e. when network status changes, entire app re-renders
There was a problem hiding this comment.
Shouldn't have any significant effect, since network status change will not be frequent in most scenarios + Expensify.tsx already uses many Onyx keys.
There was a problem hiding this comment.
But yeah, we can check it.
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
|
Looks good. No regressions found so far. |
|
Please pull main |
heyjennahay
left a comment
There was a problem hiding this comment.
Product review not required
| return; | ||
| } | ||
| hasHandledMissingIsLoadingAppRef.current = true; | ||
| Log.info('[Onyx] isLoadingApp missing after app is ready', false, { |
There was a problem hiding this comment.
Lets monitor how often this is logged in the end
|
✋ 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/mountiny in version: 9.3.9-0 🚀
|
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.3.9-2 🚀
|
Explanation of Change
We make the delegate switch reliable by writing the restricted token to the session before clearing Onyx. This ensures the token is saved even if the further flow does not complete for any reason (like if the app closes mid‑switch), so OpenApp after reopen uses the correct token and loads the delegate account.
We also add a fallback for scenarios where
isLoadingAppis missing after the app is ready. In that case we log it once and trigger OpenApp to repair the state.Fixed Issues
$ #75489
PROPOSAL:
Tests
Offline tests
QA Steps
Same.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)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
Screen.Recording.2026-01-21.at.10.27.11.AM.mov