Repository navigation
Feat: show skeleton loaders on initial home load - #99560
JmillsExpensify merged 29 commits into
Conversation
|
@codex review |
|
@ZhenjaHorbach 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] |
|
@MelvinBot review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6e5b943585
ℹ️ 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".
| }, [hasPendingOpenApp, isLoadingApp]); | ||
| }, [group, hasPendingOpenApp, isLoadingApp]); | ||
|
|
||
| return hasPendingOpenApp || (!!openAppFlushPendingByGroup[group] && isLoadingApp === true); |
There was a problem hiding this comment.
Clear the online-load latch without a mounted Home page
If the user leaves Home while an online OpenApp is pending, appLoadOnline is latched true, but Home is its only consumer, so no effect observes IS_LOADING_APP becoming false and clears that module-scoped value. If the user subsequently signs into another account while offline without revisiting Home first, the new offline-initiated request is correctly filtered out, but isLoadingApp === true combines with the stale latch here and keeps the Home skeleton visible indefinitely until reconnection. Reset this latch independently of the consumer lifecycle or scope it to the current app-load/session.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not reachable. For that skeleton to stick you'd need hasLoadedApp === false, offline, and IS_LOADING_APP true from a fresh offline-initiated OpenApp, all at once.
Signing in can't do it because auth needs the network, so the openApp() after sign-in is always queued online and reconciles the latch normally. The other offline OpenApp paths all run with the app already loaded, and delegate switches keep HAS_LOADED_APP on purpose.
The coupling itself is real though. A second consumer of useIsOnlineAppLoadPending on a screen HomePage doesn't cover would make it reachable, and nothing stops that today. Leaving it for this PR.
ReviewSolid PR — the logic is sound, the offline decision table is well-reasoned, and the automated coverage is thorough. I found no blocking issues. A few notes below, none of them blockers. Correctness of the gate. The core gate Scope of the style change. Minor notes (non-blocking)
Behavioral verification — could not confirm the transient skeleton in this environmentI attempted to verify the cold-start flow (tests 1–4) on web, but the transient skeleton could not be captured here: forcing a fresh Resolved Home after the one load transition available (skeleton window already closed):
|
|
MelvinBot's Minor Notes - not reachable. For that skeleton to stick you'd need Signing in can't do it because auth needs the network, so the The coupling itself is real though. A second consumer of |
|
🚧 dubielzyk-expensify has triggered a test Expensify/App build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6e5b943585
ℹ️ 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 isOnlineAppLoadPending = useIsOnlineAppLoadPending(); | ||
| const shouldShowHomeSkeleton = shouldShowSkeleton && (!isOffline || isOnlineAppLoadPending); |
There was a problem hiding this comment.
Handle rehydrated OpenApp as a new offline session
When the process is killed during the first online OpenApp and relaunched offline, the persisted queued/ongoing request retains initiatedOffline: false, so useIsOnlineAppLoadPending() remains true and this condition pins the Home skeleton until connectivity returns. On an authenticated cold start, AuthScreensInitHandler.tsx lines 165-189 calls reconnectApp(), not openApp(), so the documented duplicate replacement never re-stamps that surviving request. Unlike the previously discussed account-switch path, this is reachable without signing in offline; account for process-session freshness rather than treating the persisted online stamp as proof that the current offline session has an active load.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The premise doesn't hold. reconnectApp() isn't the end of the story on an unloaded cold start: it awaits hasLoadedAppPromise and, when HAS_LOADED_APP is false, calls openApp() instead (App.ts:471-476). An interrupted first OpenApp is exactly the case where HAS_LOADED_APP is still false, so that relaunch does run openApp(), the duplicate resolver replaces the surviving queued request, and the replacement is stamped initiatedOffline: true. Skeleton hidden, as documented.
The one variant that survives is a kill after the request moved to PERSISTED_ONGOING_REQUESTS: there the resolver returns noAction (RequestConflictUtils.ts:86) and the ongoing selector applies no offline filter (useInFlightRequests.ts:100), so the skeleton does stay up until reconnect. That's the deliberate exemption called out in the PR description: the request was genuinely being sent, so the load reached the network. It's the same end state as test 4, signal lost mid-load, just with a restart in between. Not changing it here.
|
@MelvinBot review |
ReviewRe-reviewed at Gate + latch (re-confirmed). One thing to eyeball (non-blocking)
Web verification — resolved Home renders cleanly; transient skeleton not capturable hereVerified on dev NewDot (web) that moving the nine Sections into the The transient cold-start skeleton (tests 1–4) still can't be staged in this harness — it needs a sign-out/sign-in loop and resolves faster than a screenshot — so please lean on the unit suite (
|
@shawnborton It’s the same on staging - that gray section is already part of the codebase, so it wasn’t added by me. staging.-.gray.block.mp4 |
Yeah, absolutely! I’ll add a few in a minute. Let me fix the padding issue first, though. |
Thoughts on fixing it here? We just need it to use the standard appBG color instead of gray. |
Yes, doable - it’s a one-line, safe change. It’s actually an opacity change on the boot loader rather than a color swap. |
225eb58 to
f7f5873
Compare
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@codex review |
|
Running a fresh test build |
|
🚧 grgia has triggered a test Expensify/App build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
|
Does anyone else need to review before we merge? |
|
I will recheck today or tomorrow |
I’d sleep better if @BartekObudzinski gives my refactor of his hook |
|
Awesome, let's please try to get this merged today. |
|
🚧 JmillsExpensify has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/JmillsExpensify in version: 9.4.91-0 🚀
|
|
🤖 Yes — one help site change was required. Draft PR: Docs updates for E/A#99560 document Home loading placeholder cards What needed documenting: this PR adds a state the help site never described — on a cold start, Home shows a fixed set of placeholder cards with shimmering bars, and the real sections replace them once the load finishes. Because the placeholder count is fixed and the resolved section count is not, the number of cards on Home visibly changes at that moment. Expensify Home Overview read as though each section is simply present or absent, with nothing in between. What I changed — one file, docs/articles/new-expensify/getting-started/Expensify-Home-Overview.md:
What I deliberately did not change. No already-documented section changed its post-load behavior, so nothing in the article was inaccurate and no existing statement needed correcting. How I verified the copySigned in on web for a real cold start and confirmed both states: shimmering placeholder rows in the section slots during load, then real content ( Written against The docs PR is a draft, labeled @sharabai, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR |
|
Deploy Blocker #101855 was identified to be related to this PR. |
|
🚀 Deployed to production by https://github.com/lakchote in version: 9.4.91-3 🚀
Bundle Size Analysis (Sentry): |





Explanation of Change
Each Home Section decides on its own whether it has anything to show, so during the first
OpenAppthe page reads as finished and nearly empty. This fills those slots with three placeholder cards built fromWidgetContainerand the skeleton primitives, beside the realForYouSectioncarrying its own shimmer. The count is fixed and maps to no Section, since a placeholder that resolves to nothing is theAnnouncementsproblem (#98780) in a new slot, and the spinner card holds the chart's own loading height (CHART_CONTENT_MIN_HEIGHT) so it keeps one height across the handover.shouldHideForYouSectionno longer reads the load state, because the shimmer stands in for the whole body except on an account known to be mid-onboarding, whose body is empty once loaded anyway.The gate is
useAppLoadSkeletonState(), which already excludesReconnectApp, combined withuseShouldWaitForAppLoad()under one name,useAppLoadSkeletonVisibility(), asuseLoadingBarVisibility()does for the loading bar. It rests onuseIsOnlineAppLoadPending(), which reports whether this load ever reached the network: without that, the placeholders either collapse to a false empty state when signal drops mid-load, or shimmer forever after an offline cold start.LOADING_STATE.mdcarries both hooks.The diff reaches files this feature does not otherwise touch. Four skeletons measured the same widget row by hand, so
pages/home/common/widgetSkeletonRow.tsxowns that geometry andHomePageSkeleton,ForYouSkeleton,SpendSummaryRowandFixCompanyCardConnectionSkeletonread it.BAR_HEIGHTmoves toSkeletonTextLine, andgetForYouSectionContainerStyleisgetWidgetRowGroupStylenow thatHomeTaskGroupandGettingStartedSectionuse it too. No rendered pixel changes. PR #100323 landed mid-review and is merged in here, foldingTimeSensitiveSectionintoForYouSectionas aHomeTaskGroup.Important
ForYouSectionhas to keep its tree position across the swap. It sits at the same index in both states and carries a key, so React matches it in place. A refactor that moves it remounts the card, which blurs a focused Concierge input and drops the caret.componentBGand reading as gray on the first paint.PERSISTED_ONGOING_REQUESTSmeans the request was being sent, so itsinitiatedOfflinestamp is stale.resolveOpenAppDuplicationConflictActionreturns{type: 'replace', index}for a queued duplicate andupdatePersistedRequestswaps the whole object.Fixed Issues
$ #98968
Tests
Preconditions, two accounts, because the placeholder count is fixed and what it resolves into is not:
Recently addedin its empty state.1. Cold start fills the Section slots, then hands over to the Sections
OpenApp.Recently addedin its empty state.2. "No recent expenses" no longer appears mid-load (Account A, the bug this PR fixes)
3. The Concierge card survives the handover (exercises the stable tree position)
4. The Concierge copy and placeholder shimmer
5. The boot loader is not gray
AuthScreenschunk takes a moment to download.6. Reconnect does not trigger the skeleton (regression coverage for the
ReconnectAppexclusion)ReconnectAppruns.7. Signal lost mid-load keeps the placeholders up
8. Narrow layout
9. An application load that never reached the network takes every placeholder down (native)
OpenAppstarts, and land on Home with the placeholders on screen.Offline tests
Tests 7 and 9 are the offline behaviour of this change. No API calls, writes or persisted data are added: the state comes from the existing request queue and
IS_LOADING_APP.QA Steps
Same as tests 1, 2, 4, 6, 7, 8 and 9, including the two-account split in the preconditions. Tests 3 and 5 need DevTools throttling, one to hold the placeholders on screen long enough to type and the other to catch the boot loader, so both are developer-facing.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, 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.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.many.cards.mp4
iOS: mWeb Safari
MacOS: Chrome / Safari
wide.few.cards.mp4
narrow.few.cards.mp4
narrow.many.cards.mp4
wide.many.cards.mp4