Skip to content

Commit 008d496

Browse files
authored
Merge pull request Expensify#66259 from Expensify/Rory-RenameOnyxProvider
[No QA] Rename missed OnyxProvider to OnyxListItemProvider
2 parents 2e0a170 + c84c6d8 commit 008d496

6 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {InputBlurContextProvider} from './components/InputBlurContext';
2020
import KeyboardProvider from './components/KeyboardProvider';
2121
import {LocaleContextProvider} from './components/LocaleContextProvider';
2222
import NavigationBar from './components/NavigationBar';
23-
import OnyxProvider from './components/OnyxListItemProvider';
23+
import OnyxListItemProvider from './components/OnyxListItemProvider';
2424
import PopoverContextProvider from './components/PopoverProvider';
2525
import {ProductTrainingContextProvider} from './components/ProductTrainingContext';
2626
import SafeArea from './components/SafeArea';
@@ -81,7 +81,7 @@ function App({url}: AppProps) {
8181
<GestureHandlerRootView style={fill}>
8282
<ComposeProviders
8383
components={[
84-
OnyxProvider,
84+
OnyxListItemProvider,
8585
ThemeProvider,
8686
ThemeStylesProvider,
8787
ThemeIllustrationsProvider,

src/components/createOnyxContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default <TOnyxKey extends OnyxKey>(onyxKeyName: TOnyxKey): CreateOnyxCont
3232
const useOnyxContext = () => {
3333
const value = useContext(Context);
3434
if (value === null) {
35-
throw new Error(`useOnyxContext must be used within a OnyxProvider [key: ${onyxKeyName}]`);
35+
throw new Error(`useOnyxContext must be used within a OnyxListItemProvider [key: ${onyxKeyName}]`);
3636
}
3737
return value as OnyxValue<TOnyxKey>;
3838
};

src/hooks/useReportWithTransactionsAndViolations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const DEFAULT_VIOLATIONS: Record<string, TransactionViolation[]> = {};
1414
function useReportWithTransactionsAndViolations(reportID?: string): [OnyxEntry<Report>, Transaction[], OnyxCollection<TransactionViolation[]>] {
1515
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {canBeMissing: false});
1616

17-
// It connects to single Onyx instance held in OnyxProvider, so it can be safely used in list items without affecting performance.
17+
// It connects to single Onyx instance held in OnyxListItemProvider, so it can be safely used in list items without affecting performance.
1818
const allReportTransactionsAndViolations = useAllReportsTransactionsAndViolations();
1919
const {transactions, violations} = allReportTransactionsAndViolations?.[reportID ?? CONST.DEFAULT_NUMBER_ID] ?? {transactions: DEFAULT_TRANSACTIONS, violations: DEFAULT_VIOLATIONS};
2020
const {isOffline} = useNetwork();

tests/actions/IOUTest.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {format} from 'date-fns';
33
import {deepEqual} from 'fast-equals';
44
import type {OnyxCollection, OnyxEntry, OnyxInputValue} from 'react-native-onyx';
55
import Onyx from 'react-native-onyx';
6-
import OnyxProvider from '@components/OnyxListItemProvider';
6+
import OnyxListItemProvider from '@components/OnyxListItemProvider';
77
import useReportWithTransactionsAndViolations from '@hooks/useReportWithTransactionsAndViolations';
88
import {
99
addSplitExpenseField,
@@ -5268,7 +5268,7 @@ describe('actions/IOU', () => {
52685268

52695269
expect(canApproveIOU(fakeReport, fakePolicy)).toBeFalsy();
52705270
// Then should return false when passing transactions directly as the third parameter instead of relying on Onyx data
5271-
const {result} = renderHook(() => useReportWithTransactionsAndViolations(reportID), {wrapper: OnyxProvider});
5271+
const {result} = renderHook(() => useReportWithTransactionsAndViolations(reportID), {wrapper: OnyxListItemProvider});
52725272
await waitForBatchedUpdates();
52735273
expect(canApproveIOU(result.current.at(0) as Report, fakePolicy, result.current.at(1) as Transaction[])).toBeFalsy();
52745274
});
@@ -5324,7 +5324,7 @@ describe('actions/IOU', () => {
53245324

53255325
expect(canApproveIOU(fakeReport, fakePolicy)).toBeFalsy();
53265326
// Then should return false when passing transactions directly as the third parameter instead of relying on Onyx data
5327-
const {result} = renderHook(() => useReportWithTransactionsAndViolations(reportID), {wrapper: OnyxProvider});
5327+
const {result} = renderHook(() => useReportWithTransactionsAndViolations(reportID), {wrapper: OnyxListItemProvider});
53285328
await waitForBatchedUpdates();
53295329
expect(canApproveIOU(result.current.at(0) as Report, fakePolicy, result.current.at(1) as Transaction[])).toBeFalsy();
53305330
});
@@ -5371,7 +5371,7 @@ describe('actions/IOU', () => {
53715371

53725372
expect(canApproveIOU(fakeReport, fakePolicy)).toBeFalsy();
53735373
// Then should return false when passing transactions directly as the third parameter instead of relying on Onyx data
5374-
const {result} = renderHook(() => useReportWithTransactionsAndViolations(reportID), {wrapper: OnyxProvider});
5374+
const {result} = renderHook(() => useReportWithTransactionsAndViolations(reportID), {wrapper: OnyxListItemProvider});
53755375
await waitForBatchedUpdates();
53765376
expect(canApproveIOU(result.current.at(0) as Report, fakePolicy, result.current.at(1) as Transaction[])).toBeFalsy();
53775377
});
@@ -5423,7 +5423,7 @@ describe('actions/IOU', () => {
54235423

54245424
expect(canApproveIOU(fakeReport, fakePolicy)).toBeTruthy();
54255425
// Then should return true when passing transactions directly as the third parameter instead of relying on Onyx data
5426-
const {result} = renderHook(() => useReportWithTransactionsAndViolations(reportID), {wrapper: OnyxProvider});
5426+
const {result} = renderHook(() => useReportWithTransactionsAndViolations(reportID), {wrapper: OnyxListItemProvider});
54275427
await waitForBatchedUpdates();
54285428
expect(canApproveIOU(result.current.at(0) as Report, fakePolicy, result.current.at(1) as Transaction[])).toBeTruthy();
54295429
});

tests/ui/PureReportActionItemTest.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Onyx from 'react-native-onyx';
66
import ComposeProviders from '@components/ComposeProviders';
77
import HTMLEngineProvider from '@components/HTMLEngineProvider';
88
import {LocaleContextProvider} from '@components/LocaleContextProvider';
9-
import OnyxProvider from '@components/OnyxProvider';
9+
import OnyxListItemProvider from '@components/OnyxListItemProvider';
1010
import OptionsListContextProvider from '@components/OptionListContextProvider';
1111
import ScreenWrapper from '@components/ScreenWrapper';
1212
import {translateLocal} from '@libs/Localize';
@@ -73,7 +73,7 @@ describe('PureReportActionItem', () => {
7373

7474
function renderItemWithAction(action: ReportAction) {
7575
return render(
76-
<ComposeProviders components={[OnyxProvider, LocaleContextProvider, HTMLEngineProvider]}>
76+
<ComposeProviders components={[OnyxListItemProvider, LocaleContextProvider, HTMLEngineProvider]}>
7777
<OptionsListContextProvider>
7878
<ScreenWrapper testID="test">
7979
<PortalProvider>

tests/ui/components/EmptySearchViewTest.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import CONST from '@src/CONST';
1010
import ONYXKEYS from '@src/ONYXKEYS';
1111
import waitForBatchedUpdates from '../../utils/waitForBatchedUpdates';
1212

13-
// Wrapper component with OnyxProvider
13+
// Wrapper component with OnyxListItemProvider
1414
function Wrapper({children}: {children: React.ReactNode}) {
1515
return (
1616
<OnyxListItemProvider>

0 commit comments

Comments
 (0)