feat: export persisted Onyx state through active provider - #848
Merged
NicolasBonet merged 7 commits intoSep 21, 2026
Merged
Conversation
Open
38 tasks
StorageMock.getAll is already a Jest mock, so mockRestore clears its default implementation and breaks later Onyx.init tests. Use one-shot mock values without restoring the shared mock.
chrispader
marked this pull request as ready for review
September 18, 2026 13:46
melvin-bot
Bot
requested review from
carlosmiceli
and removed request for
a team
September 18, 2026 13:46
Contributor
Author
|
@MelvinBot request review from @NicolasBonet and @ikevin127 |
NicolasBonet
requested review from
NicolasBonet and
shubham1206agra
and removed request for
carlosmiceli
September 18, 2026 18:31
ikevin127
reviewed
Sep 18, 2026
ikevin127
reviewed
Sep 18, 2026
ikevin127
reviewed
Sep 18, 2026
ikevin127
reviewed
Sep 18, 2026
ikevin127
reviewed
Sep 18, 2026
ikevin127
reviewed
Sep 18, 2026
Contributor
Verified ✅
🟢 Small, focused diff, nothing here blocks on correctness. The comments I dropped above are type-consistency and test-contract issues. |
Contributor
Author
|
Addressed all of @ikevin127's review comments! |
ikevin127
approved these changes
Sep 19, 2026
ikevin127
left a comment
Contributor
There was a problem hiding this comment.
🟢 LGTM - Thanks for addressing the comments
NicolasBonet
approved these changes
Sep 21, 2026
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Expensify's Troubleshoot export opens Onyx's SQLite database separately, which NitroSQLite 9.8.1 rejects as a duplicate connection. Onyx has no public API for exporting its persisted store through the active provider, so the export can fail. This PR adds
Onyx.exportState()for native and web consumers.@NicolasBonet @ikevin127
Details
exportState()waits for Onyx initialization, reads the active provider's existinggetAll()operation, and returns a plain key/value object. It excludes stale persisted rows for keys now configured as RAM-only by default. Callers can pass{includeStaleRamOnlyKeys: true}to include those rows, as the linked App export does to match its previous raw-storage query. Neither setting adds current RAM-only values from memory or writes that have not reached storage.The method does not mask data. Callers must redact sensitive values before sharing the result. The API reference and README document the option and these boundaries.
Related Issues
Expensify/App#101448
Linked E/App PR
Expensify/App#101568
Automated Tests
Tests cover persisted values, default exclusion and explicit inclusion of stale RAM-only rows, exclusion of current RAM-only values, and storage-read failures. All 666 unit tests, typecheck, and lint pass locally.
Manual Tests
These manual checks have not yet been completed on devices or browsers.
Author Checklist
Author Checklist
### Related Issuessection above### Linked E/App PRsection above, and verified this change against it (E/App CI passed and manual testing completed)TestssectiontoggleReportand notonIconClick)myBool && <MyComponent />.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)Avataris modified, I verified thatAvataris working as expected in all cases)mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
None attached; this adds a storage API without changing the normal UI.