LoadingBar rendering improvements#63025
Conversation
roryabraham
left a comment
There was a problem hiding this comment.
This approach looks good, only notes are:
- if
IS_LOADING_REPORT_DATAis no longer used, let's remove that key from the codebase - PR description is out of date
|
|
Lets also make the QA steps more practical. Something like: [Account A] Open a report with Account B |
|
@getusha done! |
srikarparsi
left a comment
There was a problem hiding this comment.
The code looks good to me other than @adhorodyski's comment, @getusha are you able to do another review of this.
Co-authored-by: Adam Horodyski <42047036+adhorodyski@users.noreply.github.com>
|
✋ 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/JS00001 in version: 9.1.72-0 🚀
|
1 similar comment
|
🚀 Deployed to staging by https://github.com/JS00001 in version: 9.1.72-0 🚀
|
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.1.72-10 🚀
|
| */ | ||
| export default function useLoadingBarVisibility(): boolean { | ||
| const [persistedRequests] = useOnyx(ONYXKEYS.PERSISTED_REQUESTS, {canBeMissing: false}); | ||
| const [ongoingRequests] = useOnyx(ONYXKEYS.PERSISTED_ONGOING_REQUESTS, {canBeMissing: false}); |
There was a problem hiding this comment.
We set canBeMissing of ONYXKEYS.PERSISTED_ONGOING_REQUESTS to true since since it can be null. (See issue #66591)
App/src/libs/actions/PersistedRequests.ts
Line 39 in 39c6b76
Explanation of Change
This change replaces
IS_LOADING_REPORT_DATAflag usage withuseLoadingBarVisibilityhook to simplify conditional rendering of loading bar as it's rendered in multiple places.Proposal: Reliably show the LoadingBar by directly hooking into SequentialQueue
Background:
LoadingBar components display loading indicators during OpenApp, ReconnectApp, and OpenReport requests. Currently, 6 components (TopBar, MoneyReportHeader, MoneyRequestHeader, HeaderView, SearchPageNarrow, SearchSidebar) rely on the IS_LOADING_REPORT_DATA Onyx key, which gets set optimistically in App.ts when requests begin and cleared when they complete. Each component has different conditional logic - some check narrow layouts, others check offline status, creating inconsistent rendering patterns. Users depend on these loading indicators to understand when the app is processing their requests.
Problem:
When users initiate network requests, they sometimes see loading indicators that don't accurately reflect actual processing status, which prevents them from understanding whether their requests are being handled. It's hard to reproduce, but we were able to observe it being unreliable.
Solution:
This provides immediate loading indicators that directly reflect actual queue processing status.
Fixed Issues
$ #63938
Tests
Basic: app initialization flow
Force offline.Narrow resolution
For narrow layout, loading bar should be shown for every open report action.
Pusher updates: new messages flow
[Account A] Open a report with Account B
[Account B] Open a report with Account A and switch tabs/close the app
[Account A] Send several messages
[Account B] Reopen the app
[Account B] Verify that there is a loading bar shown when loading new actions
Offline tests
Same as Tests.
QA Steps
Same as Tests.
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))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
Nagranie.z.ekranu.2025-06-4.o.10.39.54.mov
Android: mWeb Chrome
Nagranie.z.ekranu.2025-06-4.o.10.44.37.mov
iOS: Native
Nagranie.z.ekranu.2025-06-4.o.09.52.02.mov
iOS: mWeb Safari
Nagranie.z.ekranu.2025-06-4.o.09.56.18.mov
MacOS: Chrome / Safari
Nagranie.z.ekranu.2025-06-4.o.09.58.00.mov
MacOS: Desktop
Nagranie.z.ekranu.2025-06-4.o.10.45.31.mov