From 06f6b233e84dbb903962d73a809e85a45f5bc8ae Mon Sep 17 00:00:00 2001
From: Tomasz Misiukiewicz <tomasz.misiukiewicz@callstack.com>
Date: Wed, 30 Jul 2025 09:00:38 +0200
Subject: [PATCH 1/2] bump react-native-onyx to 2.0.130

---
 package-lock.json | 10 +++++-----
 package.json      |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index c5b88d0e621c..bbc30d799138 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -109,7 +109,7 @@
         "react-native-modal": "^13.0.0",
         "react-native-nitro-modules": "0.26.2",
         "react-native-nitro-sqlite": "9.1.10",
-        "react-native-onyx": "2.0.127",
+        "react-native-onyx": "2.0.130",
         "react-native-pager-view": "6.5.3",
         "react-native-pdf": "6.7.3",
         "react-native-performance": "^5.1.4",
@@ -34002,9 +34002,9 @@
       }
     },
     "node_modules/react-native-onyx": {
-      "version": "2.0.127",
-      "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-2.0.127.tgz",
-      "integrity": "sha512-D5EeJspj6jjL10DclBbdIGVyqInSzwyzTZDejt6+SJxThk3zTbEClddkp6gXD7T9vilhIEi7+xXYkUvD/SO75w==",
+      "version": "2.0.130",
+      "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-2.0.130.tgz",
+      "integrity": "sha512-GlrWbRBTHasQBTZcKWJ2/nZ20YACLPTGHAlBGL9CNh3cV/1Jr7r/1uIyaiYD/cLyi70PnsXPH307eXxNwf8BWA==",
       "license": "MIT",
       "dependencies": {
         "ascii-table": "0.0.9",
@@ -34016,7 +34016,7 @@
         "underscore": "^1.13.6"
       },
       "engines": {
-        "node": ">=20.19.1",
+        "node": ">=20.19.3",
         "npm": ">=10.8.2"
       },
       "peerDependencies": {
diff --git a/package.json b/package.json
index e585386b0120..4e681273bd72 100644
--- a/package.json
+++ b/package.json
@@ -179,7 +179,7 @@
     "react-native-modal": "^13.0.0",
     "react-native-nitro-modules": "0.26.2",
     "react-native-nitro-sqlite": "9.1.10",
-    "react-native-onyx": "2.0.127",
+    "react-native-onyx": "2.0.130",
     "react-native-pager-view": "6.5.3",
     "react-native-pdf": "6.7.3",
     "react-native-performance": "^5.1.4",

From aaa856e0e9caed7b52a5f43efd54cd70cfda42e1 Mon Sep 17 00:00:00 2001
From: Tomasz Misiukiewicz <tomasz.misiukiewicz@callstack.com>
Date: Thu, 31 Jul 2025 10:04:44 +0200
Subject: [PATCH 2/2] provide stable selectors for useSidebarOrderedReports

---
 src/hooks/useSidebarOrderedReports.tsx | 9 ++++++---
 src/libs/ReportUtils.ts                | 5 +++++
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/hooks/useSidebarOrderedReports.tsx b/src/hooks/useSidebarOrderedReports.tsx
index ed55aacb5918..c358b95e1af2 100644
--- a/src/hooks/useSidebarOrderedReports.tsx
+++ b/src/hooks/useSidebarOrderedReports.tsx
@@ -1,8 +1,9 @@
 import {deepEqual} from 'fast-equals';
 import React, {createContext, useCallback, useContext, useEffect, useMemo, useRef, useState} from 'react';
-import type {OnyxEntry} from 'react-native-onyx';
+import type {OnyxCollection, OnyxEntry} from 'react-native-onyx';
 import Log from '@libs/Log';
 import {getPolicyEmployeeListByIdWithoutCurrentUser} from '@libs/PolicyUtils';
+import {reportAttributesSelector} from '@libs/ReportUtils';
 import SidebarUtils from '@libs/SidebarUtils';
 import CONST from '@src/CONST';
 import ONYXKEYS from '@src/ONYXKEYS';
@@ -43,6 +44,8 @@ const policySelector = (policy: OnyxEntry<OnyxTypes.Policy>): PartialPolicyForSi
         employeeList: policy.employeeList,
     }) as PartialPolicyForSidebar;
 
+const policiesSelector = (policies: OnyxCollection<OnyxTypes.Policy>) => mapOnyxCollectionItems(policies, policySelector);
+
 function SidebarOrderedReportsContextProvider({
     children,
     /**
@@ -57,13 +60,13 @@ function SidebarOrderedReportsContextProvider({
 }: SidebarOrderedReportsContextProviderProps) {
     const [priorityMode = CONST.PRIORITY_MODE.DEFAULT] = useOnyx(ONYXKEYS.NVP_PRIORITY_MODE, {canBeMissing: true});
     const [chatReports, {sourceValue: reportUpdates}] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {canBeMissing: true});
-    const [policies, {sourceValue: policiesUpdates}] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {selector: (c) => mapOnyxCollectionItems(c, policySelector), canBeMissing: true});
+    const [policies, {sourceValue: policiesUpdates}] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {selector: policiesSelector, canBeMissing: true});
     const [transactions, {sourceValue: transactionsUpdates}] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION, {canBeMissing: true});
     const [transactionViolations, {sourceValue: transactionViolationsUpdates}] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS, {canBeMissing: true});
     const [reportNameValuePairs, {sourceValue: reportNameValuePairsUpdates}] = useOnyx(ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS, {canBeMissing: true});
     const [, {sourceValue: reportsDraftsUpdates}] = useOnyx(ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT, {canBeMissing: true});
     const [betas] = useOnyx(ONYXKEYS.BETAS, {canBeMissing: true});
-    const [reportAttributes] = useOnyx(ONYXKEYS.DERIVED.REPORT_ATTRIBUTES, {selector: (value) => value?.reports, canBeMissing: true});
+    const [reportAttributes] = useOnyx(ONYXKEYS.DERIVED.REPORT_ATTRIBUTES, {selector: reportAttributesSelector, canBeMissing: true});
     const [currentReportsToDisplay, setCurrentReportsToDisplay] = useState<ReportsToDisplayInLHN>({});
 
     const {shouldUseNarrowLayout} = useResponsiveLayout();
diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts
index 392b10186d0f..6419b3462ab5 100644
--- a/src/libs/ReportUtils.ts
+++ b/src/libs/ReportUtils.ts
@@ -11252,6 +11252,10 @@ function getReportStatusTranslation(stateNum?: number, statusNum?: number): stri
     return '';
 }
 
+function reportAttributesSelector(reportAttributes: OnyxEntry<ReportAttributesDerivedValue>) {
+    return reportAttributes?.reports;
+}
+
 export {
     areAllRequestsBeingSmartScanned,
     buildOptimisticAddCommentReportAction,
@@ -11631,6 +11635,7 @@ export {
     isWorkspaceTaskReport,
     isWorkspaceThread,
     getReportStatusTranslation,
+    reportAttributesSelector,
 };
 
 export type {
