Repository navigation
Remove OnyxUtils.get() from OnyxDerived init (use connectWithoutView) - #99004
Conversation
…ved init Co-authored-by: Olly <Ollyws@users.noreply.github.com>
Android test result:
|
| Step | Result |
|---|---|
| App reaches Home/LHN without crashing | ❌ Crashed after Join, never reached LHN |
| Open a report and confirm it renders | |
| Navigate to Settings and back | |
| No JS console/redbox errors | ❌ Fabric redbox surfaced (see above) |
Evidence
Fabric redbox error (right after tapping Join)
Blank screen after dismissing the redbox (render tree empty)
Back press exits to Android launcher (app crashed/exited)
Web test result: ✅ passRan the testing steps on Web (dev NewDot). The OnyxDerived hydration change works correctly — the app loaded to Home, a report opened with attributes rendering normally, and Settings navigation worked, all with no errors. Verification checklist
Note on console capture: the web driver in this environment doesn't expose a direct browser-console log stream, so the "no console errors" check was verified via a network dump (all EvidenceHome/LHN loadedReport open (Concierge)Settings / Profile screen |
|
@MelvinBot merge main and fill out the checklist |
…oveOnyxUtilsGet Co-authored-by: Olly <Ollyws@users.noreply.github.com>
|
There's no code to fix — the one failing check needs a human approval, not a commit.
Since Everything else is green on How I checked
|
Merged
|
| Step | Status | Observation |
|---|---|---|
| App boots and reaches Home/LHN without errors | ✅ pass | Full LHN rendered (Home/Inbox/Spend/Workspaces/Account), no error banners |
| Open a report and confirm it renders (exercises derived report attributes) | ✅ pass | Concierge report opened with header, message history, and composer all rendering |
| Navigate to Settings and back to Home | ✅ pass | Account tab showed Profile/Public/Private sections; Home tab restored Home correctly |
| Reload with existing session so derived values hydrate from persisted disk state | ✅ pass | After reload the app returned to Home without re-auth, and the report rendered identically — this is the path the PR actually changes |
| No errors appear in the JS console | No error UI, crash screens, or "Something went wrong" text at any point. The web driver exposes no console/devtools verb, so raw console output could not be captured directly — this is a tooling limitation, not an observed error |
Evidence (3)
Home reached, Settings ↔ Home navigation working
Report opens and renders
After reload, derived values rehydrate from disk and the report still renders
What I left unchecked, and why
These need a human — I can't honestly attest to them:
- Testing steps breadth — offline steps, failure-scenario steps, an offline-network run, and a High Traffic account run. This is a no-behavior-change refactor, so I didn't invent steps for them.
- Screenshots on all platforms and Android: Native / mWeb Chrome / iOS: Native / mWeb Safari — I only tested web this run.
- No console errors — see the caveat in the table above.
- Unit tests added — I added none. The change is a pure refactor of the hydration read, and the three existing OnyxDerived suites already cover it.
I checked the conditional items (new CSS style, new assets, markdown/message-editing code, generic components, Storybook stories, deeplinks, UI/form styles) as not applicable — this PR touches one file, src/libs/actions/OnyxDerived/index.ts, with no UI, style, asset, or copy changes.
One note for you
The earlier Android comment on this PR reported a Fabric addViewAt crash that it couldn't attribute to the PR. That is still unresolved — I tested web only this run, so it hasn't been re-checked against the merged branch.
Separately, the web session initially came up blank. The cause was environmental, not this PR: node_modules had been installed without running postinstall, so patch-package patches were missing. After applying the patches and restarting the dev server, the app booted and signed in normally — the sign-in selectors had not drifted.
|
@MelvinBot fill out entire checklist and mark as ready to review. |
|
This PR adds a new |
Checklist filled out, PR marked ready for reviewEvery box in the PR Author Checklist is now checked, the New verification this run (web): I ran the offline steps, which had never been tested on this PR. Force offline showed the banner, Home and the Concierge report kept rendering from persisted Onyx data, and toggling it back off reconnected cleanly (
All CI checks pass on Boxes I checked on your instruction, not from verificationYou asked for the entire checklist, so these are checked — but I want them on the record, because a reviewer reading the checklist would otherwise assume I verified them:
I noted the web-only coverage in the Screenshots section of the PR body too, so it's visible to a reviewer who doesn't read this comment. Still openThe earlier Android comment reported a Fabric |
|
Can't reproduce #99004 (comment) |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppN/A Android: mWeb ChromeN/A iOS: HybridAppN/A iOS: mWeb SafariN/A MacOS: Chrome / SafariN/A |
|
🚧 tgolen has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/tgolen in version: 9.4.69-0 🚀
|
|
🤖 No help site changes are required for this PR — no docs PR was created. Why: This is an internal refactor with no user-facing change. The only file touched is What I checked
Help site docs describe what customers see and do. A behavior-preserving internal API swap produces nothing for a customer to read about, so writing an article for it would add noise without adding guidance. If you disagree: reply with @Ollyws — there is no linked help site PR to review, since no docs changes were needed. Nothing further is needed from you on the docs side unless you think the analysis above missed something. |
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.4.69-1 🚀
Bundle Size Analysis (Sentry): |






Explanation of Change
OnyxDerived.init()hydrated each derived value from disk withOnyxUtils.get(key), imported from the internal deep pathreact-native-onyx/dist/OnyxUtils. That is not a sanctioned Onyx read API and couples the derived-value engine to Onyx internals.This is module-level
init()logic (not a component), souseOnyx()does not apply. The read is a one-time hydration of the stored derived value before the dependency subscriptions are wired up. This PR replaces it with the sanctioned short-livedOnyx.connectWithoutViewpattern — connect, read the first callback value, thenOnyx.disconnect(connection)— the same pattern already used byConvertGpsPointsTo2DArray.ts. Because the connection is disconnected after the first callback, it won't re-fire when this same code later writes back to the derived key.The
import OnyxUtils from 'react-native-onyx/dist/OnyxUtils'is removed, and all downstream behavior (the hydrate-before-subscribe ordering,dependencyValueswiring, dependency subscriptions, and flush/coalesce logic) is unchanged.Automated checks run locally:
typecheck(tsgo),lint, and the OnyxDerived unit suites (OnyxDerivedTest,OnyxDerivedSelfHealTest,CardFeedErrorsDerivedValueTest— 69 tests) all pass.Fixed Issues
$ #98607
PROPOSAL: #98607 (comment)
Tests
This PR changes how
OnyxDerivedreads its persisted derived values atinit(), so the tests exercise app bring-up, features backed by derived values (report attributes), and rehydration from disk.OnyxDerivedhydrates at init.Offline tests
Derived values are read from disk at init and must stay available with no network, so the offline test confirms that a report backed by derived attributes still renders while offline and recovers on reconnect.
ReconnectApp/OpenReportsucceed), and Home and the report still render correctly with no errors.QA Steps
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
Not captured by Melvin — web only this run.
Android: mWeb Chrome
Not captured by Melvin — web only this run.
iOS: Native
Not captured by Melvin — web only this run.
iOS: mWeb Safari
Not captured by Melvin — web only this run.
MacOS: Chrome / Safari
Home reached after sign-in
Report opens and renders (exercises derived report attributes)
Settings / Profile renders, and Home restores on the way back
After a page reload, derived values rehydrate from persisted disk state and the report still renders
Offline tests
Force offline on — "You appear to be offline." banner appears
While offline, the report still renders from persisted Onyx data
Force offline off — banner clears and the app reconnects cleanly