From b44c622daae134f60da3934a53250fb1b50add7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Henriques?= Date: Fri, 24 Apr 2026 17:52:39 +0100 Subject: [PATCH 1/4] Use newest Onyx changes --- package-lock.json | 8 ++++---- package.json | 2 +- patches/react-native-onyx/details.md | 2 +- ...e-onyx+3.0.63.patch => react-native-onyx+3.0.70.patch} | 0 4 files changed, 6 insertions(+), 6 deletions(-) rename patches/react-native-onyx/{react-native-onyx+3.0.63.patch => react-native-onyx+3.0.70.patch} (100%) diff --git a/package-lock.json b/package-lock.json index 404dabb3906d..c3569b1892f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -115,7 +115,7 @@ "react-native-localize": "^3.5.4", "react-native-nitro-modules": "0.35.0", "react-native-nitro-sqlite": "9.6.0", - "react-native-onyx": "3.0.63", + "react-native-onyx": "git+https://github.com/Expensify/react-native-onyx.git#e6e917bad03edff8a01685d848e9fc5f18f7532a", "react-native-pager-view": "8.0.0", "react-native-pdf": "7.0.2", "react-native-permissions": "^5.4.0", @@ -34481,9 +34481,9 @@ } }, "node_modules/react-native-onyx": { - "version": "3.0.63", - "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-3.0.63.tgz", - "integrity": "sha512-6UUpjyUh9viXll9M2YomXM9PMg+791foSPA7E0fazgWfrUAmofNwo4xkXT4k3NDdToZFOYxaXL0uw5z00g/MOA==", + "version": "3.0.70", + "resolved": "git+ssh://git@github.com/Expensify/react-native-onyx.git#e6e917bad03edff8a01685d848e9fc5f18f7532a", + "integrity": "sha512-LQuSp5Y4SDqRAymLYKiJny3sx51ps7Fbd2mcPBPR4w/LLQ3rjW/xH0LC1qsZ9lKgDiQSHrL4VolFms+RZPZt0Q==", "license": "MIT", "dependencies": { "ascii-table": "0.0.9", diff --git a/package.json b/package.json index 138faffb48a7..608857eff8c1 100644 --- a/package.json +++ b/package.json @@ -178,7 +178,7 @@ "react-native-localize": "^3.5.4", "react-native-nitro-modules": "0.35.0", "react-native-nitro-sqlite": "9.6.0", - "react-native-onyx": "3.0.63", + "react-native-onyx": "git+https://github.com/Expensify/react-native-onyx.git#e6e917bad03edff8a01685d848e9fc5f18f7532a", "react-native-pager-view": "8.0.0", "react-native-pdf": "7.0.2", "react-native-permissions": "^5.4.0", diff --git a/patches/react-native-onyx/details.md b/patches/react-native-onyx/details.md index 67ad7c054e85..08bdbeb96d93 100644 --- a/patches/react-native-onyx/details.md +++ b/patches/react-native-onyx/details.md @@ -1,6 +1,6 @@ # `react-native-onyx` patches -### [react-native-onyx+3.0.63.patch](react-native-onyx+3.0.63.patch) +### [react-native-onyx+3.0.70.patch](react-native-onyx+3.0.70.patch) - Reason: Onyx v3.0.59 ([PR #756](https://github.com/Expensify/react-native-onyx/pull/756)) added a state reset inside the `subscribe` callback of `useOnyx` to fix stale data when keys change dynamically. However, this reset runs unconditionally — including on initial mount — which causes `useSyncExternalStore` to see a new snapshot reference after subscription, triggering one extra render per `useOnyx` hook. This patch guards the reset with a `hasMountedRef` flag so it only runs on key-change re-subscriptions, not on initial mount. - E/App issue: https://github.com/Expensify/App/issues/85416 diff --git a/patches/react-native-onyx/react-native-onyx+3.0.63.patch b/patches/react-native-onyx/react-native-onyx+3.0.70.patch similarity index 100% rename from patches/react-native-onyx/react-native-onyx+3.0.63.patch rename to patches/react-native-onyx/react-native-onyx+3.0.70.patch From ed5d407341c8d2c2e99174d90e7748e1c5ec96b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Henriques?= Date: Fri, 24 Apr 2026 18:21:17 +0100 Subject: [PATCH 2/4] Fix tests --- tests/unit/DebugUtilsTest.ts | 4 +--- tests/unit/SidebarUtilsTest.ts | 4 +--- tests/unit/WorkspacesSettingsUtilsTest.ts | 12 ++++++------ 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/tests/unit/DebugUtilsTest.ts b/tests/unit/DebugUtilsTest.ts index 97219f58c1ed..22bf98a5fb77 100644 --- a/tests/unit/DebugUtilsTest.ts +++ b/tests/unit/DebugUtilsTest.ts @@ -1552,10 +1552,8 @@ describe('DebugUtils', () => { }, ], }; + await Onyx.set(ONYXKEYS.SESSION, {accountID: 1234}); await Onyx.multiSet({ - [ONYXKEYS.SESSION]: { - accountID: 1234, - }, [`${ONYXKEYS.COLLECTION.REPORT}0` as const]: report, [`${ONYXKEYS.COLLECTION.REPORT}1` as const]: { reportID: '1', diff --git a/tests/unit/SidebarUtilsTest.ts b/tests/unit/SidebarUtilsTest.ts index c243cc8fdd32..3e762d3eb4ff 100644 --- a/tests/unit/SidebarUtilsTest.ts +++ b/tests/unit/SidebarUtilsTest.ts @@ -103,10 +103,8 @@ describe('SidebarUtils', () => { }; await act(async () => { + await Onyx.set(ONYXKEYS.SESSION, {accountID: 12345}); await Onyx.multiSet({ - [ONYXKEYS.SESSION]: { - accountID: 12345, - }, ...MOCK_REPORTS, ...MOCK_TRANSACTION_VIOLATIONS, [`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${MOCK_REPORT.reportID}` as const]: MOCK_REPORT_ACTIONS, diff --git a/tests/unit/WorkspacesSettingsUtilsTest.ts b/tests/unit/WorkspacesSettingsUtilsTest.ts index 5bc0f064974a..22f313abf90f 100644 --- a/tests/unit/WorkspacesSettingsUtilsTest.ts +++ b/tests/unit/WorkspacesSettingsUtilsTest.ts @@ -35,8 +35,8 @@ describe('WorkspacesSettingsUtils', () => { const reportActions = mockData.reportActions; const transactions = mockData.transactions; + await Onyx.set(ONYXKEYS.SESSION, session); await Onyx.multiSet({ - session, ...(reports as ReportCollectionDataSet), ...(reportActions as OnyxCollection), ...(transactionViolations as OnyxCollection), @@ -59,10 +59,10 @@ describe('WorkspacesSettingsUtils', () => { const session = mockData.session; const reportActions = mockData.reportActions; + await Onyx.set(ONYXKEYS.SESSION, session); await Onyx.multiSet({ ...(reports as ReportCollectionDataSet), ...(reportActions as OnyxCollection), - session, }); await waitForBatchedUpdates(); @@ -84,8 +84,8 @@ describe('WorkspacesSettingsUtils', () => { const reportActions = mockData.reportActions; const transactions = mockData.transactions; + await Onyx.set(ONYXKEYS.SESSION, session); await Onyx.multiSet({ - session, ...(reports as ReportCollectionDataSet), ...(reportActions as OnyxCollection), ...(transactionViolations as OnyxCollection), @@ -108,10 +108,10 @@ describe('WorkspacesSettingsUtils', () => { const session = mockData.session; const reportActions = mockData.reportActions; + await Onyx.set(ONYXKEYS.SESSION, session); await Onyx.multiSet({ ...(reports as ReportCollectionDataSet), ...(reportActions as OnyxCollection), - session, }); const reportIDs = Object.values(reports).map((report) => report.reportID); @@ -134,8 +134,8 @@ describe('WorkspacesSettingsUtils', () => { const reportActions = mockData.reportActions; const transactions = mockData.transactions; + await Onyx.set(ONYXKEYS.SESSION, session); await Onyx.multiSet({ - session, ...(reports as ReportCollectionDataSet), ...(reportActions as OnyxCollection), ...(transactionViolations as OnyxCollection), @@ -158,10 +158,10 @@ describe('WorkspacesSettingsUtils', () => { const session = mockData.session; const reportActions = mockData.reportActions; + await Onyx.set(ONYXKEYS.SESSION, session); await Onyx.multiSet({ ...(reports as ReportCollectionDataSet), ...(reportActions as OnyxCollection), - session, }); const reportIDs = Object.values(reports).map((report) => report.reportID); From a2edf647f658bf206cbbebeac8f0dd83b21bf945 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Henriques?= Date: Mon, 4 May 2026 10:23:21 +0100 Subject: [PATCH 3/4] Revert tests --- tests/unit/DebugUtilsTest.ts | 4 +++- tests/unit/SidebarUtilsTest.ts | 4 +++- tests/unit/WorkspacesSettingsUtilsTest.ts | 12 ++++++------ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/unit/DebugUtilsTest.ts b/tests/unit/DebugUtilsTest.ts index 22bf98a5fb77..97219f58c1ed 100644 --- a/tests/unit/DebugUtilsTest.ts +++ b/tests/unit/DebugUtilsTest.ts @@ -1552,8 +1552,10 @@ describe('DebugUtils', () => { }, ], }; - await Onyx.set(ONYXKEYS.SESSION, {accountID: 1234}); await Onyx.multiSet({ + [ONYXKEYS.SESSION]: { + accountID: 1234, + }, [`${ONYXKEYS.COLLECTION.REPORT}0` as const]: report, [`${ONYXKEYS.COLLECTION.REPORT}1` as const]: { reportID: '1', diff --git a/tests/unit/SidebarUtilsTest.ts b/tests/unit/SidebarUtilsTest.ts index fdcc2e0acc82..5d35405fd867 100644 --- a/tests/unit/SidebarUtilsTest.ts +++ b/tests/unit/SidebarUtilsTest.ts @@ -103,8 +103,10 @@ describe('SidebarUtils', () => { }; await act(async () => { - await Onyx.set(ONYXKEYS.SESSION, {accountID: 12345}); await Onyx.multiSet({ + [ONYXKEYS.SESSION]: { + accountID: 12345, + }, ...MOCK_REPORTS, ...MOCK_TRANSACTION_VIOLATIONS, [`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${MOCK_REPORT.reportID}` as const]: MOCK_REPORT_ACTIONS, diff --git a/tests/unit/WorkspacesSettingsUtilsTest.ts b/tests/unit/WorkspacesSettingsUtilsTest.ts index 22f313abf90f..5bc0f064974a 100644 --- a/tests/unit/WorkspacesSettingsUtilsTest.ts +++ b/tests/unit/WorkspacesSettingsUtilsTest.ts @@ -35,8 +35,8 @@ describe('WorkspacesSettingsUtils', () => { const reportActions = mockData.reportActions; const transactions = mockData.transactions; - await Onyx.set(ONYXKEYS.SESSION, session); await Onyx.multiSet({ + session, ...(reports as ReportCollectionDataSet), ...(reportActions as OnyxCollection), ...(transactionViolations as OnyxCollection), @@ -59,10 +59,10 @@ describe('WorkspacesSettingsUtils', () => { const session = mockData.session; const reportActions = mockData.reportActions; - await Onyx.set(ONYXKEYS.SESSION, session); await Onyx.multiSet({ ...(reports as ReportCollectionDataSet), ...(reportActions as OnyxCollection), + session, }); await waitForBatchedUpdates(); @@ -84,8 +84,8 @@ describe('WorkspacesSettingsUtils', () => { const reportActions = mockData.reportActions; const transactions = mockData.transactions; - await Onyx.set(ONYXKEYS.SESSION, session); await Onyx.multiSet({ + session, ...(reports as ReportCollectionDataSet), ...(reportActions as OnyxCollection), ...(transactionViolations as OnyxCollection), @@ -108,10 +108,10 @@ describe('WorkspacesSettingsUtils', () => { const session = mockData.session; const reportActions = mockData.reportActions; - await Onyx.set(ONYXKEYS.SESSION, session); await Onyx.multiSet({ ...(reports as ReportCollectionDataSet), ...(reportActions as OnyxCollection), + session, }); const reportIDs = Object.values(reports).map((report) => report.reportID); @@ -134,8 +134,8 @@ describe('WorkspacesSettingsUtils', () => { const reportActions = mockData.reportActions; const transactions = mockData.transactions; - await Onyx.set(ONYXKEYS.SESSION, session); await Onyx.multiSet({ + session, ...(reports as ReportCollectionDataSet), ...(reportActions as OnyxCollection), ...(transactionViolations as OnyxCollection), @@ -158,10 +158,10 @@ describe('WorkspacesSettingsUtils', () => { const session = mockData.session; const reportActions = mockData.reportActions; - await Onyx.set(ONYXKEYS.SESSION, session); await Onyx.multiSet({ ...(reports as ReportCollectionDataSet), ...(reportActions as OnyxCollection), + session, }); const reportIDs = Object.values(reports).map((report) => report.reportID); From 4ac70b4d583f57e6e1605a1f38b85a437443005b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Henriques?= Date: Wed, 13 May 2026 09:21:09 +0100 Subject: [PATCH 4/4] Bump Onyx to 3.0.73 --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index a365a3c03b1d..cbad8b979c8c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -115,7 +115,7 @@ "react-native-localize": "^3.5.4", "react-native-nitro-modules": "0.35.0", "react-native-nitro-sqlite": "9.6.0", - "react-native-onyx": "3.0.71", + "react-native-onyx": "3.0.73", "react-native-pager-view": "8.0.0", "react-native-pdf": "7.0.2", "react-native-permissions": "^5.4.0", @@ -34993,9 +34993,9 @@ } }, "node_modules/react-native-onyx": { - "version": "3.0.71", - "resolved": "git+ssh://git@github.com/Expensify/react-native-onyx.git#283159e4925b207b883ccd0645fc7405be21585e", - "integrity": "sha512-hiIHe1/gpyTv0EVPzwc8RwNgogsmOgNbJ2zKXGiJifRnhIRNbsXSCPG6HtrBnQN+YOIRKnXwkZa75F9QH2WudQ==", + "version": "3.0.73", + "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-3.0.73.tgz", + "integrity": "sha512-0fvL8q7Rx3QBoHJJLB4e2wd0a9/4f//FvTBGKJliU5rkO/05APKZKFxMprSQpBm+O+i3T2R1lwSQbeaj9AbIDA==", "license": "MIT", "dependencies": { "ascii-table": "0.0.9", diff --git a/package.json b/package.json index 993baa93fbec..5f4b96a2d304 100644 --- a/package.json +++ b/package.json @@ -179,7 +179,7 @@ "react-native-localize": "^3.5.4", "react-native-nitro-modules": "0.35.0", "react-native-nitro-sqlite": "9.6.0", - "react-native-onyx": "3.0.71", + "react-native-onyx": "3.0.73", "react-native-pager-view": "8.0.0", "react-native-pdf": "7.0.2", "react-native-permissions": "^5.4.0",