Skip to content

Commit d9553a3

Browse files
committed
fix: remove onyx connect
1 parent 68c4a93 commit d9553a3

File tree

54 files changed

+257
-145
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+257
-145
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"test:debug": "TZ=utc NODE_OPTIONS='--inspect-brk --experimental-vm-modules' jest --runInBand",
4848
"perf-test": "NODE_OPTIONS=--experimental-vm-modules npx reassure",
4949
"typecheck": "NODE_OPTIONS=--max_old_space_size=8192 tsc",
50-
"lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=111 --cache --cache-location=node_modules/.cache/eslint --concurrency=auto",
50+
"lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=110 --cache --cache-location=node_modules/.cache/eslint --concurrency=auto",
5151
"lint-changed": "NODE_OPTIONS=--max_old_space_size=8192 ./scripts/lintChanged.sh",
5252
"check-lazy-loading": "ts-node scripts/checkLazyLoading.ts",
5353
"lint-watch": "npx eslint-watch --watch --changed",
@@ -427,4 +427,4 @@
427427
"node": "20.19.5",
428428
"npm": "10.8.2"
429429
}
430-
}
430+
}

src/components/HTMLEngineProvider/HTMLRenderers/ConciergeLinkRenderer.tsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
import React from 'react';
22
import type {StyleProp, TextStyle} from 'react-native';
3+
import {useOnyx} from 'react-native-onyx';
34
import type {CustomRendererProps, TPhrasing, TText} from 'react-native-render-html';
45
import {TNodeChildrenRenderer} from 'react-native-render-html';
56
import * as HTMLEngineUtils from '@components/HTMLEngineProvider/htmlEngineUtils';
67
import Text from '@components/Text';
78
import useThemeStyles from '@hooks/useThemeStyles';
8-
import {navigateToConciergeChat as navigateToConciergeChatAction} from '@userActions/Report';
9+
import {navigateToConciergeChat} from '@userActions/Report';
10+
import ONYXKEYS from '@src/ONYXKEYS';
911

1012
type ConciergeLinkRendererProps = CustomRendererProps<TText | TPhrasing>;
1113

12-
/**
13-
* Simple wrapper to create a stable reference without passing event args to navigation function.
14-
*/
15-
function navigateToConciergeChat() {
16-
navigateToConciergeChatAction();
17-
}
18-
1914
function ConciergeLinkRenderer({tnode, style}: ConciergeLinkRendererProps) {
2015
const styles = useThemeStyles();
16+
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {canBeMissing: true});
2117

22-
// Define link style based on context
18+
// Define link style based on contextsa
2319
let linkStyle: StyleProp<TextStyle> = styles.link;
2420

2521
// Special handling for links in RBR to maintain consistent font size
@@ -35,7 +31,7 @@ function ConciergeLinkRenderer({tnode, style}: ConciergeLinkRendererProps) {
3531
return (
3632
<Text
3733
style={[style as TextStyle, linkStyle]}
38-
onPress={navigateToConciergeChat}
34+
onPress={() => navigateToConciergeChat(personalDetails)}
3935
suppressHighlighting
4036
>
4137
<TNodeChildrenRenderer tnode={tnode} />

src/components/MoneyReportHeader.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ function MoneyReportHeader({
302302
const theme = useTheme();
303303
const {isOffline} = useNetwork();
304304
const {isExpenseSplit} = getOriginalTransactionWithSplitInfo(transaction, originalTransaction);
305+
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {canBeMissing: true});
305306

306307
const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: true});
307308
const [isHoldMenuVisible, setIsHoldMenuVisible] = useState(false);
@@ -918,7 +919,7 @@ function MoneyReportHeader({
918919
const duplicateTransaction = transactions.find((reportTransaction) => isDuplicate(reportTransaction, email ?? '', accountID, moneyRequestReport, policy));
919920
const transactionID = duplicateTransaction?.transactionID;
920921
const iouAction = getIOUActionForReportID(moneyRequestReport?.reportID, transactionID);
921-
const createdTransactionThreadReport = createTransactionThreadReport(moneyRequestReport, iouAction);
922+
const createdTransactionThreadReport = createTransactionThreadReport(personalDetails, moneyRequestReport, iouAction);
922923
threadID = createdTransactionThreadReport?.reportID;
923924
}
924925
Navigation.navigate(ROUTES.TRANSACTION_DUPLICATE_REVIEW_PAGE.getRoute(threadID));

src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ function MoneyRequestReportActionsList({
602602
setIsFloatingMessageCounterVisible(false);
603603

604604
if (!hasNewestReportAction) {
605-
openReport(report.reportID);
605+
openReport(personalDetails, report.reportID);
606606
reportScrollManager.scrollToEnd();
607607
return;
608608
}

src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ function MoneyRequestReportTransactionList({
358358

359359
if (!reportIDToNavigate) {
360360
const transaction = sortedTransactions.find((t) => t.transactionID === activeTransactionID);
361-
const transactionThreadReport = createTransactionThreadReport(report, iouAction, transaction);
361+
const transactionThreadReport = createTransactionThreadReport(personalDetailsList, report, iouAction, transaction);
362362
if (transactionThreadReport) {
363363
reportIDToNavigate = transactionThreadReport.reportID;
364364
routeParams.reportID = reportIDToNavigate;
@@ -376,7 +376,7 @@ function MoneyRequestReportTransactionList({
376376
Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute(routeParams));
377377
});
378378
},
379-
[reportActions, visualOrderTransactionIDs, sortedTransactions, report, markReportIDAsExpense],
379+
[reportActions, visualOrderTransactionIDs, sortedTransactions, report, markReportIDAsExpense, personalDetailsList],
380380
);
381381

382382
const {amountColumnSize, dateColumnSize, taxAmountColumnSize} = useMemo(() => {

src/components/MoneyRequestReportView/MoneyRequestReportTransactionsNavigation.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ function MoneyRequestReportTransactionsNavigation({currentTransactionID, isFromR
3838
const [transactionIDsList = getEmptyArray<string>()] = useOnyx(ONYXKEYS.TRANSACTION_THREAD_NAVIGATION_TRANSACTION_IDS, {
3939
canBeMissing: true,
4040
});
41+
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {canBeMissing: true});
4142

4243
const {markReportIDAsExpense} = useContext(WideRHPContext);
4344

@@ -138,7 +139,7 @@ function MoneyRequestReportTransactionsNavigation({currentTransactionID, isFromR
138139
}
139140
// The transaction thread doesn't exist yet, so we should create it
140141
if (!nextThreadReportID) {
141-
const transactionThreadReport = createTransactionThreadReport(parentReport, nextParentReportAction, nextTransaction);
142+
const transactionThreadReport = createTransactionThreadReport(personalDetails, parentReport, nextParentReportAction, nextTransaction);
142143
navigationParams.reportID = transactionThreadReport?.reportID;
143144
}
144145
// Wait for the next frame to ensure Onyx has processed the optimistic data updates from setOptimisticTransactionThread or createTransactionThreadReport before navigating
@@ -166,7 +167,7 @@ function MoneyRequestReportTransactionsNavigation({currentTransactionID, isFromR
166167
}
167168
// The transaction thread doesn't exist yet, so we should create it
168169
if (!prevThreadReportID) {
169-
const transactionThreadReport = createTransactionThreadReport(parentReport, prevParentReportAction, prevTransaction);
170+
const transactionThreadReport = createTransactionThreadReport(personalDetails, parentReport, prevParentReportAction, prevTransaction);
170171
navigationParams.reportID = transactionThreadReport?.reportID;
171172
}
172173
// Wait for the next frame to ensure Onyx has processed the optimistic data updates from setOptimisticTransactionThread or createTransactionThreadReport before navigating

src/components/PromotedActionsBar.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import type {StyleProp, ViewStyle} from 'react-native';
33
import {View} from 'react-native';
4+
import {OnyxEntry} from 'react-native-onyx';
45
import useLocalize from '@hooks/useLocalize';
56
import useTheme from '@hooks/useTheme';
67
import useThemeStyles from '@hooks/useThemeStyles';
@@ -10,6 +11,7 @@ import {joinRoom, navigateToAndOpenReport, navigateToAndOpenReportWithAccountIDs
1011
import {callFunctionIfActionIsAllowed} from '@userActions/Session';
1112
import CONST from '@src/CONST';
1213
import ROUTES from '@src/ROUTES';
14+
import {PersonalDetailsList} from '@src/types/onyx';
1315
import type OnyxReport from '@src/types/onyx/Report';
1416
import Button from './Button';
1517
import type {ThreeDotsMenuItem} from './HeaderWithBackButton/types';
@@ -24,7 +26,7 @@ type BasePromotedActions = typeof CONST.PROMOTED_ACTIONS.PIN | typeof CONST.PROM
2426
type PromotedActionsType = Record<BasePromotedActions, (report: OnyxReport) => PromotedAction> & {
2527
[CONST.PROMOTED_ACTIONS.SHARE]: (report: OnyxReport, backTo?: string) => PromotedAction;
2628
} & {
27-
[CONST.PROMOTED_ACTIONS.MESSAGE]: (params: {reportID?: string; accountID?: number; login?: string}) => PromotedAction;
29+
[CONST.PROMOTED_ACTIONS.MESSAGE]: (params: {reportID?: string; accountID?: number; login?: string; allPersonalDetails: OnyxEntry<PersonalDetailsList>}) => PromotedAction;
2830
};
2931

3032
const PromotedActions = {
@@ -45,7 +47,7 @@ const PromotedActions = {
4547
joinRoom(report);
4648
}),
4749
}),
48-
message: ({reportID, accountID, login}) => ({
50+
message: ({reportID, accountID, login, allPersonalDetails}) => ({
4951
key: CONST.PROMOTED_ACTIONS.MESSAGE,
5052
icon: Expensicons.CommentBubbles,
5153
translationKey: 'common.message',
@@ -57,11 +59,11 @@ const PromotedActions = {
5759

5860
// The accountID might be optimistic, so we should use the login if we have it
5961
if (login) {
60-
navigateToAndOpenReport([login], false);
62+
navigateToAndOpenReport(allPersonalDetails, [login], false);
6163
return;
6264
}
6365
if (accountID) {
64-
navigateToAndOpenReportWithAccountIDs([accountID]);
66+
navigateToAndOpenReportWithAccountIDs(allPersonalDetails, [accountID]);
6567
}
6668
},
6769
}),

src/components/ReportActionItem/MoneyRequestAction.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ function MoneyRequestAction({
104104
() => [styles.cursorPointer, isHovered ? styles.reportPreviewBoxHoverBorder : undefined, style],
105105
[isHovered, style, styles.cursorPointer, styles.reportPreviewBoxHoverBorder],
106106
);
107+
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {canBeMissing: true});
107108

108109
const reportPreviewStyles = StyleUtils.getMoneyRequestReportPreviewStyle(shouldUseNarrowLayout, 1, undefined, undefined);
109110

@@ -125,7 +126,7 @@ function MoneyRequestAction({
125126
const transactionID = isMoneyRequestAction(action) ? getOriginalMessage(action)?.IOUTransactionID : CONST.DEFAULT_NUMBER_ID;
126127

127128
if (!action?.childReportID && transactionID && action.reportActionID) {
128-
const transactionThreadReport = createTransactionThreadReport(iouReport, action);
129+
const transactionThreadReport = createTransactionThreadReport(personalDetails, iouReport, action);
129130
if (shouldOpenReportInRHP) {
130131
Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({reportID: transactionThreadReport?.reportID, backTo: Navigation.getActiveRoute()}));
131132
return;

src/components/Search/SearchPageHeader/SearchPageHeaderInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ function SearchPageHeaderInput({queryJSON, searchRouterListVisible, hideSearchRo
295295
timestamp: endTime,
296296
});
297297
} else if ('login' in item) {
298-
navigateToAndOpenReport(item.login ? [item.login] : [], false);
298+
navigateToAndOpenReport(personalDetails, item.login ? [item.login] : [], false);
299299

300300
const endTime = Date.now();
301301
Log.info('[CMD_K_DEBUG] Page user navigation handled', false, {

src/components/Search/SearchRouter/SearchRouter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ function SearchRouter({onRouterClose, shouldHideInputCaret, isSearchRouterDispla
442442
if (item?.reportID) {
443443
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(item.reportID));
444444
} else if ('login' in item) {
445-
navigateToAndOpenReport(item.login ? [item.login] : [], false);
445+
navigateToAndOpenReport(personalDetails, item.login ? [item.login] : [], false);
446446
}
447447
});
448448
onRouterClose();

0 commit comments

Comments
 (0)