From f48990066441d732b00cd83b5badc8aa60db78d9 Mon Sep 17 00:00:00 2001 From: Tomasz Misiukiewicz Date: Wed, 13 Aug 2025 12:41:22 +0200 Subject: [PATCH 1/3] bump onyx to 2.0.132 --- 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 8d79db110db0..83e38aba6d07 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.132", "react-native-pager-view": "6.5.3", "react-native-pdf": "6.7.3", "react-native-performance": "^5.1.4", @@ -34006,9 +34006,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.132", + "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-2.0.132.tgz", + "integrity": "sha512-Rd9KOMSvDGsc1cjiYhWDzXNjPbwVjSVU/WIeEiBjDhIv0TbkBB/OmDDaslWLRq3eajC0VM1ljU0QtltPwBLxzg==", "license": "MIT", "dependencies": { "ascii-table": "0.0.9", @@ -34020,7 +34020,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 602e264f827e..3482f2f043ca 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.132", "react-native-pager-view": "6.5.3", "react-native-pdf": "6.7.3", "react-native-performance": "^5.1.4", From c2d7f6890d2e883c01b63fcf9eaa575df41539bd Mon Sep 17 00:00:00 2001 From: Tomasz Misiukiewicz Date: Wed, 13 Aug 2025 13:28:07 +0200 Subject: [PATCH 2/3] stabilize policy selector --- src/hooks/useSidebarOrderedReports.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hooks/useSidebarOrderedReports.tsx b/src/hooks/useSidebarOrderedReports.tsx index d3a43c179f16..e87a435b7a3c 100644 --- a/src/hooks/useSidebarOrderedReports.tsx +++ b/src/hooks/useSidebarOrderedReports.tsx @@ -1,6 +1,6 @@ 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 SidebarUtils from '@libs/SidebarUtils'; @@ -44,6 +44,8 @@ const policySelector = (policy: OnyxEntry): PartialPolicyForSi employeeList: policy.employeeList, }) as PartialPolicyForSidebar; +const policiesSelector = (policies: OnyxCollection) => mapOnyxCollectionItems(policies, policySelector); + function SidebarOrderedReportsContextProvider({ children, /** @@ -59,7 +61,7 @@ function SidebarOrderedReportsContextProvider({ const {localeCompare} = useLocalize(); 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}); From bdf21f4bdc00e34eb367f81bc78f4bc9c23d7dfe Mon Sep 17 00:00:00 2001 From: Tomasz Misiukiewicz Date: Thu, 14 Aug 2025 11:12:21 +0200 Subject: [PATCH 3/3] fix infinite loop in duplicate review --- src/pages/TransactionDuplicate/Review.tsx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/pages/TransactionDuplicate/Review.tsx b/src/pages/TransactionDuplicate/Review.tsx index a847cd3a0139..a29ffee8c7dd 100644 --- a/src/pages/TransactionDuplicate/Review.tsx +++ b/src/pages/TransactionDuplicate/Review.tsx @@ -1,6 +1,7 @@ import {useRoute} from '@react-navigation/native'; -import React, {useEffect, useMemo} from 'react'; +import React, {useCallback, useEffect, useMemo} from 'react'; import {View} from 'react-native'; +import type {OnyxCollection} from 'react-native-onyx'; import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; import Button from '@components/Button'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; @@ -23,6 +24,7 @@ import {isReportIDApproved, isSettled} from '@libs/ReportUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type SCREENS from '@src/SCREENS'; +import type {Transaction} from '@src/types/onyx'; import DuplicateTransactionsList from './DuplicateTransactionsList'; function TransactionDuplicateReview() { @@ -39,15 +41,19 @@ function TransactionDuplicateReview() { () => transactionViolations?.find((violation) => violation.name === CONST.VIOLATIONS.DUPLICATED_TRANSACTION)?.data?.duplicates ?? [], [transactionViolations], ); - const transactionIDs = transactionID ? [transactionID, ...duplicateTransactionIDs] : duplicateTransactionIDs; + const transactionIDs = useMemo(() => (transactionID ? [transactionID, ...duplicateTransactionIDs] : duplicateTransactionIDs), [transactionID, duplicateTransactionIDs]); + const transactionsSelector = useCallback( + (allTransactions: OnyxCollection) => + transactionIDs + .map((id) => allTransactions?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${id}`]) + .sort((a, b) => new Date(a?.created ?? '').getTime() - new Date(b?.created ?? '').getTime()), + [transactionIDs], + ); const [transactions] = useOnyx( ONYXKEYS.COLLECTION.TRANSACTION, { - selector: (allTransactions) => - transactionIDs - .map((id) => allTransactions?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${id}`]) - .sort((a, b) => new Date(a?.created ?? '').getTime() - new Date(b?.created ?? '').getTime()), + selector: transactionsSelector, canBeMissing: true, }, [transactionIDs],