From 5590c17316a5ed71394d2dddad65b1ab13708a03 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Fri, 10 May 2024 12:20:17 +0200 Subject: [PATCH 1/5] Refactor LHNOptionsList to use useOnyx --- .../LHNOptionsList/LHNOptionsList.tsx | 58 +++++-------------- src/components/LHNOptionsList/types.ts | 30 +--------- 2 files changed, 15 insertions(+), 73 deletions(-) diff --git a/src/components/LHNOptionsList/LHNOptionsList.tsx b/src/components/LHNOptionsList/LHNOptionsList.tsx index 8c43ae542932..b0ef2a4edaef 100644 --- a/src/components/LHNOptionsList/LHNOptionsList.tsx +++ b/src/components/LHNOptionsList/LHNOptionsList.tsx @@ -4,7 +4,7 @@ import {FlashList} from '@shopify/flash-list'; import type {ReactElement} from 'react'; import React, {memo, useCallback, useContext, useEffect, useMemo, useRef} from 'react'; import {StyleSheet, View} from 'react-native'; -import {withOnyx} from 'react-native-onyx'; +import {useOnyx} from 'react-native-onyx'; import BlockingView from '@components/BlockingViews/BlockingView'; import Icon from '@components/Icon'; import * as Expensicons from '@components/Icon/Expensicons'; @@ -23,31 +23,24 @@ import variables from '@styles/variables'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import OptionRowLHNData from './OptionRowLHNData'; -import type {LHNOptionsListOnyxProps, LHNOptionsListProps, RenderItemProps} from './types'; +import type {LHNOptionsListProps, RenderItemProps} from './types'; const keyExtractor = (item: string) => `report_${item}`; -function LHNOptionsList({ - style, - contentContainerStyles, - data, - onSelectRow, - optionMode, - shouldDisableFocusOptions = false, - reports = {}, - reportActions = {}, - policy = {}, - preferredLocale = CONST.LOCALES.DEFAULT, - personalDetails = {}, - transactions = {}, - draftComments = {}, - transactionViolations = {}, - onFirstItemRendered = () => {}, -}: LHNOptionsListProps) { +function LHNOptionsList({style, contentContainerStyles, data, onSelectRow, optionMode, shouldDisableFocusOptions = false, onFirstItemRendered = () => {}}: LHNOptionsListProps) { const {saveScrollOffset, getScrollOffset} = useContext(ScrollOffsetContext); const flashListRef = useRef>(null); const route = useRoute(); + const [reports] = useOnyx(ONYXKEYS.COLLECTION.REPORT); + const [reportActions] = useOnyx(ONYXKEYS.COLLECTION.REPORT_ACTIONS); + const [policy] = useOnyx(ONYXKEYS.COLLECTION.POLICY); + const [preferredLocale] = useOnyx(ONYXKEYS.NVP_PREFERRED_LOCALE, {initialValue: CONST.LOCALES.DEFAULT}); + const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST); + const [transactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION); + const [draftComments] = useOnyx(ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT); + const [transactionViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS); + const theme = useTheme(); const styles = useThemeStyles(); const {canUseViolations} = usePermissions(); @@ -246,31 +239,6 @@ function LHNOptionsList({ LHNOptionsList.displayName = 'LHNOptionsList'; -export default withOnyx({ - reports: { - key: ONYXKEYS.COLLECTION.REPORT, - }, - reportActions: { - key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, - }, - policy: { - key: ONYXKEYS.COLLECTION.POLICY, - }, - preferredLocale: { - key: ONYXKEYS.NVP_PREFERRED_LOCALE, - }, - personalDetails: { - key: ONYXKEYS.PERSONAL_DETAILS_LIST, - }, - transactions: { - key: ONYXKEYS.COLLECTION.TRANSACTION, - }, - draftComments: { - key: ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT, - }, - transactionViolations: { - key: ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS, - }, -})(memo(LHNOptionsList)); +export default memo(LHNOptionsList); export type {LHNOptionsListProps}; diff --git a/src/components/LHNOptionsList/types.ts b/src/components/LHNOptionsList/types.ts index 0f0c921747b4..7248742654d2 100644 --- a/src/components/LHNOptionsList/types.ts +++ b/src/components/LHNOptionsList/types.ts @@ -10,32 +10,6 @@ import type {EmptyObject} from '@src/types/utils/EmptyObject'; type OptionMode = ValueOf; -type LHNOptionsListOnyxProps = { - /** The policy which the user has access to and which the report could be tied to */ - policy: OnyxCollection; - - /** All reports shared with the user */ - reports: OnyxCollection; - - /** Array of report actions for this report */ - reportActions: OnyxCollection; - - /** Indicates which locale the user currently has selected */ - preferredLocale: OnyxEntry; - - /** List of users' personal details */ - personalDetails: OnyxEntry; - - /** The transaction from the parent report action */ - transactions: OnyxCollection; - - /** List of draft comments */ - draftComments: OnyxCollection; - - /** The list of transaction violations */ - transactionViolations: OnyxCollection; -}; - type CustomLHNOptionsListProps = { /** Wrapper style for the section list */ style?: StyleProp; @@ -59,7 +33,7 @@ type CustomLHNOptionsListProps = { onFirstItemRendered: () => void; }; -type LHNOptionsListProps = CustomLHNOptionsListProps & LHNOptionsListOnyxProps; +type LHNOptionsListProps = CustomLHNOptionsListProps; type OptionRowLHNDataProps = { /** Whether row should be focused */ @@ -141,4 +115,4 @@ type OptionRowLHNProps = { type RenderItemProps = {item: string}; -export type {LHNOptionsListProps, OptionRowLHNDataProps, OptionRowLHNProps, LHNOptionsListOnyxProps, RenderItemProps}; +export type {LHNOptionsListProps, OptionRowLHNDataProps, OptionRowLHNProps, RenderItemProps}; From 575b0be19bdd958a0de0d4d73443418bf90fb885 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Fri, 10 May 2024 16:51:38 +0200 Subject: [PATCH 2/5] fix SidebarTest --- tests/unit/SidebarTest.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/SidebarTest.ts b/tests/unit/SidebarTest.ts index c037c1ced3f0..10f9b4afd4dd 100644 --- a/tests/unit/SidebarTest.ts +++ b/tests/unit/SidebarTest.ts @@ -53,9 +53,9 @@ describe('Sidebar', () => { // Given the user is in all betas const betas = [CONST.BETAS.DEFAULT_ROOMS]; - LHNTestUtils.getDefaultRenderedSidebarLinks('0'); return ( waitForBatchedUpdates() + .then(() => LHNTestUtils.getDefaultRenderedSidebarLinks('0')) // When Onyx is updated with the data and the sidebar re-renders .then(() => { const reportCollection: ReportCollectionDataSet = { @@ -105,9 +105,9 @@ describe('Sidebar', () => { // Given the user is in all betas const betas = [CONST.BETAS.DEFAULT_ROOMS]; - LHNTestUtils.getDefaultRenderedSidebarLinks('0'); return ( waitForBatchedUpdates() + .then(() => LHNTestUtils.getDefaultRenderedSidebarLinks('0')) // When Onyx is updated with the data and the sidebar re-renders .then(() => { const reportCollection: ReportCollectionDataSet = { From e903c1df50dc13098e32a28e03c12d17ac569c56 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Fri, 10 May 2024 17:02:02 +0200 Subject: [PATCH 3/5] fix SidebarOrderTest --- tests/unit/SidebarOrderTest.ts | 109 ++++++++++++++++----------------- 1 file changed, 53 insertions(+), 56 deletions(-) diff --git a/tests/unit/SidebarOrderTest.ts b/tests/unit/SidebarOrderTest.ts index 644bba5a589b..a5285fe186a2 100644 --- a/tests/unit/SidebarOrderTest.ts +++ b/tests/unit/SidebarOrderTest.ts @@ -62,33 +62,29 @@ describe('Sidebar', () => { expect(screen.toJSON()).toBe(null); }); - it('is rendered with an empty list when personal details exist', () => { - // Given the sidebar is rendered with default props - LHNTestUtils.getDefaultRenderedSidebarLinks(); - - return ( - waitForBatchedUpdates() - // When Onyx is updated with some personal details - .then(() => - Onyx.multiSet({ - [ONYXKEYS.PERSONAL_DETAILS_LIST]: LHNTestUtils.fakePersonalDetails, - [ONYXKEYS.IS_LOADING_APP]: false, - }), - ) - - // Then the component should be rendered with an empty list since it will get past the early return - .then(() => { - expect(screen.toJSON()).not.toBe(null); - const navigatesToChatHintText = Localize.translateLocal('accessibilityHints.navigatesToChat'); - expect(screen.queryAllByAccessibilityHint(navigatesToChatHintText)).toHaveLength(0); - }) - ); - }); + it('is rendered with an empty list when personal details exist', () => + waitForBatchedUpdates() + // Given the sidebar is rendered with default props + .then(() => LHNTestUtils.getDefaultRenderedSidebarLinks('0')) + + // When Onyx is updated with some personal details + .then(() => + Onyx.multiSet({ + [ONYXKEYS.PERSONAL_DETAILS_LIST]: LHNTestUtils.fakePersonalDetails, + [ONYXKEYS.IS_LOADING_APP]: false, + }), + ) + + // Then the component should be rendered with an empty list since it will get past the early return + .then(() => { + expect(screen.toJSON()).not.toBe(null); + const navigatesToChatHintText = Localize.translateLocal('accessibilityHints.navigatesToChat'); + expect(screen.queryAllByAccessibilityHint(navigatesToChatHintText)).toHaveLength(0); + })); it('contains one report when a report is in Onyx', () => { // Given a single report const report = LHNTestUtils.getFakeReport([1, 2]); - LHNTestUtils.getDefaultRenderedSidebarLinks(report.reportID); const reportCollectionDataSet: ReportCollectionDataSet = { [`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`]: report, @@ -96,6 +92,8 @@ describe('Sidebar', () => { return ( waitForBatchedUpdates() + .then(() => LHNTestUtils.getDefaultRenderedSidebarLinks(report.reportID)) + // When Onyx is updated with the data and the sidebar re-renders .then(() => Onyx.multiSet({ @@ -114,8 +112,6 @@ describe('Sidebar', () => { }); it('orders items with most recently updated on top', () => { - LHNTestUtils.getDefaultRenderedSidebarLinks(); - // Given three unread reports in the recently updated order of 3, 2, 1 const report1 = LHNTestUtils.getFakeReport([1, 2], 3); const report2 = LHNTestUtils.getFakeReport([3, 4], 2); @@ -134,6 +130,8 @@ describe('Sidebar', () => { return ( waitForBatchedUpdates() + .then(() => LHNTestUtils.getDefaultRenderedSidebarLinks()) + // When Onyx is updated with the data and the sidebar re-renders .then(() => Onyx.multiSet({ @@ -173,8 +171,6 @@ describe('Sidebar', () => { Report.addComment(report3.reportID, 'Hi, this is a comment'); const currentReportId = report1.reportID; - LHNTestUtils.getDefaultRenderedSidebarLinks(currentReportId); - const reportCollectionDataSet: ReportCollectionDataSet = { [`${ONYXKEYS.COLLECTION.REPORT}${report1.reportID}`]: report1, [`${ONYXKEYS.COLLECTION.REPORT}${report2.reportID}`]: report2, @@ -183,6 +179,8 @@ describe('Sidebar', () => { return ( waitForBatchedUpdates() + .then(() => LHNTestUtils.getDefaultRenderedSidebarLinks(currentReportId)) + // When Onyx is updated with the data and the sidebar re-renders .then(() => Onyx.multiSet({ @@ -211,8 +209,6 @@ describe('Sidebar', () => { }); it('reorders the reports to always have the most recently updated one on top', () => { - LHNTestUtils.getDefaultRenderedSidebarLinks(); - // Given three reports in the recently updated order of 3, 2, 1 const report1 = LHNTestUtils.getFakeReport([1, 2], 3); const report2 = LHNTestUtils.getFakeReport([3, 4], 2); @@ -231,6 +227,8 @@ describe('Sidebar', () => { return ( waitForBatchedUpdates() + .then(() => LHNTestUtils.getDefaultRenderedSidebarLinks()) + // When Onyx is updated with the data and the sidebar re-renders .then(() => Onyx.multiSet({ @@ -282,8 +280,6 @@ describe('Sidebar', () => { Report.addComment(report2.reportID, 'Hi, this is a comment'); Report.addComment(report3.reportID, 'Hi, this is a comment'); - LHNTestUtils.getDefaultRenderedSidebarLinks(taskReport.reportID); - const reportCollectionDataSet: ReportCollectionDataSet = { [`${ONYXKEYS.COLLECTION.REPORT}${report1.reportID}`]: report1, [`${ONYXKEYS.COLLECTION.REPORT}${report2.reportID}`]: report2, @@ -293,6 +289,8 @@ describe('Sidebar', () => { return ( waitForBatchedUpdates() + .then(() => LHNTestUtils.getDefaultRenderedSidebarLinks(taskReport.reportID)) + // When Onyx is updated with the data and the sidebar re-renders .then(() => Onyx.multiSet({ @@ -346,8 +344,6 @@ describe('Sidebar', () => { Report.addComment(report2.reportID, 'Hi, this is a comment'); Report.addComment(report3.reportID, 'Hi, this is a comment'); - LHNTestUtils.getDefaultRenderedSidebarLinks(report3.reportID); - const reportCollectionDataSet: ReportCollectionDataSet = { [`${ONYXKEYS.COLLECTION.REPORT}${report1.reportID}`]: report1, [`${ONYXKEYS.COLLECTION.REPORT}${report2.reportID}`]: report2, @@ -357,6 +353,8 @@ describe('Sidebar', () => { return ( waitForBatchedUpdates() + .then(() => LHNTestUtils.getDefaultRenderedSidebarLinks(report3.reportID)) + // When Onyx is updated with the data and the sidebar re-renders .then(() => Onyx.multiSet({ @@ -413,8 +411,6 @@ describe('Sidebar', () => { Report.addComment(report2.reportID, 'Hi, this is a comment'); Report.addComment(report3.reportID, 'Hi, this is a comment'); - LHNTestUtils.getDefaultRenderedSidebarLinks(report3.reportID); - const reportCollectionDataSet: ReportCollectionDataSet = { [`${ONYXKEYS.COLLECTION.REPORT}${report1.reportID}`]: report1, [`${ONYXKEYS.COLLECTION.REPORT}${report2.reportID}`]: report2, @@ -424,6 +420,8 @@ describe('Sidebar', () => { return ( waitForBatchedUpdates() + .then(() => LHNTestUtils.getDefaultRenderedSidebarLinks(report3.reportID)) + // When Onyx is updated with the data and the sidebar re-renders .then(() => Onyx.multiSet({ @@ -464,7 +462,6 @@ describe('Sidebar', () => { Report.addComment(report3.reportID, 'Hi, this is a comment'); const currentReportId = report2.reportID; - LHNTestUtils.getDefaultRenderedSidebarLinks(currentReportId); const reportCollectionDataSet: ReportCollectionDataSet = { [`${ONYXKEYS.COLLECTION.REPORT}${report1.reportID}`]: report1, @@ -474,6 +471,8 @@ describe('Sidebar', () => { return ( waitForBatchedUpdates() + .then(() => LHNTestUtils.getDefaultRenderedSidebarLinks(currentReportId)) + // When Onyx is updated with the data and the sidebar re-renders .then(() => Onyx.multiSet({ @@ -507,8 +506,6 @@ describe('Sidebar', () => { }); it('removes the pencil icon when draft is removed', () => { - LHNTestUtils.getDefaultRenderedSidebarLinks(); - // Given a single report // And the report has a draft const report: OnyxTypes.Report = { @@ -521,6 +518,8 @@ describe('Sidebar', () => { return ( waitForBatchedUpdates() + .then(() => LHNTestUtils.getDefaultRenderedSidebarLinks()) + // When Onyx is updated with the data and the sidebar re-renders .then(() => Onyx.multiSet({ @@ -548,8 +547,6 @@ describe('Sidebar', () => { }); it('removes the pin icon when chat is unpinned', () => { - LHNTestUtils.getDefaultRenderedSidebarLinks(); - // Given a single report // And the report is pinned const report: OnyxTypes.Report = { @@ -563,6 +560,8 @@ describe('Sidebar', () => { return ( waitForBatchedUpdates() + .then(() => LHNTestUtils.getDefaultRenderedSidebarLinks()) + // When Onyx is updated with the data and the sidebar re-renders .then(() => Onyx.multiSet({ @@ -624,8 +623,6 @@ describe('Sidebar', () => { const currentReportId = report2.reportID; const currentlyLoggedInUserAccountID = 9; - LHNTestUtils.getDefaultRenderedSidebarLinks(currentReportId); - const reportCollectionDataSet: ReportCollectionDataSet = { [`${ONYXKEYS.COLLECTION.REPORT}${report1.reportID}`]: report1, [`${ONYXKEYS.COLLECTION.REPORT}${report2.reportID}`]: report2, @@ -635,6 +632,8 @@ describe('Sidebar', () => { return ( waitForBatchedUpdates() + .then(() => LHNTestUtils.getDefaultRenderedSidebarLinks(currentReportId)) + // When Onyx is updated with the data and the sidebar re-renders .then(() => Onyx.multiSet({ @@ -683,8 +682,6 @@ describe('Sidebar', () => { isPinned: true, }; - LHNTestUtils.getDefaultRenderedSidebarLinks('0'); - const reportCollectionDataSet: ReportCollectionDataSet = { [`${ONYXKEYS.COLLECTION.REPORT}${report1.reportID}`]: report1, [`${ONYXKEYS.COLLECTION.REPORT}${report2.reportID}`]: report2, @@ -693,6 +690,8 @@ describe('Sidebar', () => { return ( waitForBatchedUpdates() + .then(() => LHNTestUtils.getDefaultRenderedSidebarLinks('0')) + // When Onyx is updated with the data and the sidebar re-renders .then(() => Onyx.multiSet({ @@ -745,8 +744,6 @@ describe('Sidebar', () => { ...LHNTestUtils.getFakeReport([7, 8], 0), }; - LHNTestUtils.getDefaultRenderedSidebarLinks('0'); - const reportCollectionDataSet: ReportCollectionDataSet = { [`${ONYXKEYS.COLLECTION.REPORT}${report1.reportID}`]: report1, [`${ONYXKEYS.COLLECTION.REPORT}${report2.reportID}`]: report2, @@ -761,6 +758,8 @@ describe('Sidebar', () => { return ( waitForBatchedUpdates() + .then(() => LHNTestUtils.getDefaultRenderedSidebarLinks('0')) + // When Onyx is updated with the data and the sidebar re-renders .then(() => Onyx.multiSet({ @@ -824,8 +823,6 @@ describe('Sidebar', () => { // Given the user is in all betas const betas = [CONST.BETAS.DEFAULT_ROOMS]; - LHNTestUtils.getDefaultRenderedSidebarLinks('0'); - const reportCollectionDataSet: ReportCollectionDataSet = { [`${ONYXKEYS.COLLECTION.REPORT}${report1.reportID}`]: report1, [`${ONYXKEYS.COLLECTION.REPORT}${report2.reportID}`]: report2, @@ -834,6 +831,8 @@ describe('Sidebar', () => { return ( waitForBatchedUpdates() + .then(() => LHNTestUtils.getDefaultRenderedSidebarLinks('0')) + // When Onyx is updated with the data and the sidebar re-renders .then(() => Onyx.multiSet({ @@ -860,8 +859,6 @@ describe('Sidebar', () => { describe('in #focus mode', () => { it('alphabetizes chats', () => { - LHNTestUtils.getDefaultRenderedSidebarLinks(); - const report1 = LHNTestUtils.getFakeReport([1, 2], 3, true); const report2 = LHNTestUtils.getFakeReport([3, 4], 2, true); const report3 = LHNTestUtils.getFakeReport([5, 6], 1, true); @@ -875,6 +872,7 @@ describe('Sidebar', () => { return ( waitForBatchedUpdates() + .then(() => LHNTestUtils.getDefaultRenderedSidebarLinks('0')) // Given the sidebar is rendered in #focus mode (hides read chats) // with all reports having unread comments .then(() => @@ -926,8 +924,6 @@ describe('Sidebar', () => { // Given the user is in all betas const betas = [CONST.BETAS.DEFAULT_ROOMS]; - LHNTestUtils.getDefaultRenderedSidebarLinks('0'); - const reportCollectionDataSet: ReportCollectionDataSet = { [`${ONYXKEYS.COLLECTION.REPORT}${report1.reportID}`]: report1, [`${ONYXKEYS.COLLECTION.REPORT}${report2.reportID}`]: report2, @@ -936,6 +932,8 @@ describe('Sidebar', () => { return ( waitForBatchedUpdates() + .then(() => LHNTestUtils.getDefaultRenderedSidebarLinks('0')) + // When Onyx is updated with the data and the sidebar re-renders .then(() => Onyx.multiSet({ @@ -1060,8 +1058,6 @@ describe('Sidebar', () => { const currentlyLoggedInUserAccountID = 13; - LHNTestUtils.getDefaultRenderedSidebarLinks('0'); - const reportCollectionDataSet: ReportCollectionDataSet = { [`${ONYXKEYS.COLLECTION.REPORT}${report1.reportID}`]: report1, [`${ONYXKEYS.COLLECTION.REPORT}${report2.reportID}`]: report2, @@ -1077,6 +1073,7 @@ describe('Sidebar', () => { return ( waitForBatchedUpdates() + .then(() => LHNTestUtils.getDefaultRenderedSidebarLinks('0')) // When Onyx is updated with the data and the sidebar re-renders .then(() => Onyx.multiSet({ @@ -1123,8 +1120,6 @@ describe('Sidebar', () => { Report.addComment(report2.reportID, 'Hi, this is a comment'); Report.addComment(report3.reportID, 'Hi, this is a comment'); - LHNTestUtils.getDefaultRenderedSidebarLinks('0'); - const reportCollectionDataSet: ReportCollectionDataSet = { [`${ONYXKEYS.COLLECTION.REPORT}${report1.reportID}`]: report1, [`${ONYXKEYS.COLLECTION.REPORT}${report2.reportID}`]: report2, @@ -1133,6 +1128,8 @@ describe('Sidebar', () => { return ( waitForBatchedUpdates() + .then(() => LHNTestUtils.getDefaultRenderedSidebarLinks('0')) + // When Onyx is updated with the data and the sidebar re-renders .then(() => Onyx.multiSet({ From d584ab3d5f81a247304e03649e58efc1d7f2d47d Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Mon, 10 Jun 2024 13:17:14 +0200 Subject: [PATCH 4/5] use preferredLocale via useLocalize --- src/components/LHNOptionsList/LHNOptionsList.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/LHNOptionsList/LHNOptionsList.tsx b/src/components/LHNOptionsList/LHNOptionsList.tsx index ea4bdb004667..b719f667736c 100644 --- a/src/components/LHNOptionsList/LHNOptionsList.tsx +++ b/src/components/LHNOptionsList/LHNOptionsList.tsx @@ -35,7 +35,6 @@ function LHNOptionsList({style, contentContainerStyles, data, onSelectRow, optio const [reports] = useOnyx(ONYXKEYS.COLLECTION.REPORT); const [reportActions] = useOnyx(ONYXKEYS.COLLECTION.REPORT_ACTIONS); const [policy] = useOnyx(ONYXKEYS.COLLECTION.POLICY); - const [preferredLocale] = useOnyx(ONYXKEYS.NVP_PREFERRED_LOCALE, {initialValue: CONST.LOCALES.DEFAULT}); const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST); const [transactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION); const [draftComments] = useOnyx(ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT); @@ -44,7 +43,7 @@ function LHNOptionsList({style, contentContainerStyles, data, onSelectRow, optio const theme = useTheme(); const styles = useThemeStyles(); const {canUseViolations} = usePermissions(); - const {translate} = useLocalize(); + const {translate, preferredLocale} = useLocalize(); const {shouldUseNarrowLayout} = useResponsiveLayout(); const shouldShowEmptyLHN = shouldUseNarrowLayout && data.length === 0; From 300a14cb3ea671da16302fa8b2a0f63f4f7e37b4 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Mon, 10 Jun 2024 13:24:51 +0200 Subject: [PATCH 5/5] use legacy arguments --- tests/unit/SidebarOrderTest.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/SidebarOrderTest.ts b/tests/unit/SidebarOrderTest.ts index 8a1a47cd75cf..98120a53b6d4 100644 --- a/tests/unit/SidebarOrderTest.ts +++ b/tests/unit/SidebarOrderTest.ts @@ -66,7 +66,7 @@ describe('Sidebar', () => { it('is rendered with an empty list when personal details exist', () => waitForBatchedUpdates() // Given the sidebar is rendered with default props - .then(() => LHNTestUtils.getDefaultRenderedSidebarLinks('0')) + .then(() => LHNTestUtils.getDefaultRenderedSidebarLinks()) // When Onyx is updated with some personal details .then(() =>