Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"test:debug": "TZ=utc NODE_OPTIONS='--inspect-brk --experimental-vm-modules' jest --runInBand",
"perf-test": "NODE_OPTIONS=--experimental-vm-modules npx reassure",
"typecheck": "NODE_OPTIONS=--max_old_space_size=8192 tsc",
"lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=260 --cache --cache-location=node_modules/.cache/eslint",
"lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=259 --cache --cache-location=node_modules/.cache/eslint",
"lint-changed": "NODE_OPTIONS=--max_old_space_size=8192 ./scripts/lintChanged.sh",
"lint-watch": "npx eslint-watch --watch --changed",
"shellcheck": "./scripts/shellCheck.sh",
Expand Down
2 changes: 2 additions & 0 deletions src/components/TestDrive/Modal/EmployeeTestDriveModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function EmployeeTestDriveModal() {
const reportID = generateReportID();
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {canBeMissing: true});
const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`, {canBeMissing: true});
const [currentDate] = useOnyx(ONYXKEYS.CURRENT_DATE, {canBeMissing: true});
const route = useRoute<PlatformStackRouteProp<TestDriveModalNavigatorParamList, typeof SCREENS.TEST_DRIVE_MODAL.ROOT>>();
const [bossEmail, setBossEmail] = useState(route.params?.bossEmail ?? '');
const [formError, setFormError] = useState<string | undefined>();
Expand Down Expand Up @@ -70,6 +71,7 @@ function EmployeeTestDriveModal() {
newIouRequestType: CONST.IOU.REQUEST_TYPE.SCAN,
report,
parentReport,
currentDate,
});

setMoneyRequestReceipt(transactionID, source, filename, true, CONST.TEST_RECEIPT.FILE_TYPE, false, true);
Expand Down
21 changes: 12 additions & 9 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@
newIouRequestType: IOURequestType | undefined;
report: OnyxEntry<OnyxTypes.Report>;
parentReport: OnyxEntry<OnyxTypes.Report>;
currentDate: string | undefined;
lastSelectedDistanceRates?: OnyxEntry<OnyxTypes.LastSelectedDistanceRates>;
};

Expand Down Expand Up @@ -644,7 +645,7 @@
};

let allPersonalDetails: OnyxTypes.PersonalDetailsList = {};
Onyx.connect({

Check warning on line 648 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
allPersonalDetails = value ?? {};
Expand Down Expand Up @@ -685,13 +686,13 @@
};

let allBetas: OnyxEntry<OnyxTypes.Beta[]>;
Onyx.connect({

Check warning on line 689 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.BETAS,
callback: (value) => (allBetas = value),
});

let allTransactions: NonNullable<OnyxCollection<OnyxTypes.Transaction>> = {};
Onyx.connect({

Check warning on line 695 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -705,7 +706,7 @@
});

let allTransactionDrafts: NonNullable<OnyxCollection<OnyxTypes.Transaction>> = {};
Onyx.connect({

Check warning on line 709 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION_DRAFT,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -714,7 +715,7 @@
});

let allTransactionViolations: NonNullable<OnyxCollection<OnyxTypes.TransactionViolations>> = {};
Onyx.connect({

Check warning on line 718 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -728,7 +729,7 @@
});

let allDraftSplitTransactions: NonNullable<OnyxCollection<OnyxTypes.Transaction>> = {};
Onyx.connect({

Check warning on line 732 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -737,7 +738,7 @@
});

let allNextSteps: NonNullable<OnyxCollection<OnyxTypes.ReportNextStep>> = {};
Onyx.connect({

Check warning on line 741 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.NEXT_STEP,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -746,14 +747,14 @@
});

let allPolicyCategories: OnyxCollection<OnyxTypes.PolicyCategories> = {};
Onyx.connect({

Check warning on line 750 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY_CATEGORIES,
waitForCollectionCallback: true,
callback: (val) => (allPolicyCategories = val),
});

const allPolicies: OnyxCollection<OnyxTypes.Policy> = {};
Onyx.connect({

Check warning on line 757 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY,
callback: (val, key) => {
if (!key) {
Expand Down Expand Up @@ -786,7 +787,7 @@
});

let allReports: OnyxCollection<OnyxTypes.Report>;
Onyx.connect({

Check warning on line 790 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand Down Expand Up @@ -821,14 +822,6 @@
},
});

let currentDate: OnyxEntry<string> = '';
Onyx.connect({
key: ONYXKEYS.CURRENT_DATE,
callback: (value) => {
currentDate = value;
},
});

let quickAction: OnyxEntry<OnyxTypes.QuickAction> = {};
Onyx.connect({
key: ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE,
Expand Down Expand Up @@ -913,7 +906,17 @@
* @param report the report to attach the transaction to
* @param parentReport the parent report to attach the transaction to
*/
function initMoneyRequest({reportID, policy, isFromGlobalCreate, currentIouRequestType, newIouRequestType, report, parentReport, lastSelectedDistanceRates}: InitMoneyRequestParams) {
function initMoneyRequest({
reportID,
policy,
isFromGlobalCreate,
currentIouRequestType,
newIouRequestType,
report,
parentReport,
currentDate = '',
lastSelectedDistanceRates,
}: InitMoneyRequestParams) {
// Generate a brand new transactionID
// This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850
// eslint-disable-next-line deprecation/deprecation
Expand Down
2 changes: 2 additions & 0 deletions src/pages/Search/SearchPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ function SearchPage({route}: SearchPageProps) {
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const isMobileSelectionModeEnabled = useMobileSelectionMode();
const [lastPaymentMethods] = useOnyx(ONYXKEYS.NVP_LAST_PAYMENT_METHOD, {canBeMissing: true});
const [currentDate] = useOnyx(ONYXKEYS.CURRENT_DATE, {canBeMissing: true});
const newReportID = generateReportID();
const [newReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${newReportID}`, {canBeMissing: true});
const [newParentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${newReport?.parentReportID}`, {canBeMissing: true});
Expand Down Expand Up @@ -544,6 +545,7 @@ function SearchPage({route}: SearchPageProps) {
newIouRequestType: CONST.IOU.REQUEST_TYPE.SCAN,
report: newReport,
parentReport: newParentReport,
currentDate,
});

const newReceiptFiles: ReceiptFile[] = [];
Expand Down
4 changes: 3 additions & 1 deletion src/pages/Share/SubmitDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ function SubmitDetailsPage({
const [policyTags] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_TAGS}${getIOURequestPolicyID(transaction, report)}`, {canBeMissing: false});
const [lastLocationPermissionPrompt] = useOnyx(ONYXKEYS.NVP_LAST_LOCATION_PERMISSION_PROMPT, {canBeMissing: false});
const [reportAttributesDerived] = useOnyx(ONYXKEYS.DERIVED.REPORT_ATTRIBUTES, {canBeMissing: true, selector: (val) => val?.reports});
const [currentDate] = useOnyx(ONYXKEYS.CURRENT_DATE, {canBeMissing: true});
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const [startLocationPermissionFlow, setStartLocationPermissionFlow] = useState(false);

Expand All @@ -76,8 +77,9 @@ function SubmitDetailsPage({
newIouRequestType: CONST.IOU.REQUEST_TYPE.SCAN,
report,
parentReport,
currentDate,
});
}, [reportOrAccountID, policy, report, parentReport]);
}, [reportOrAccountID, policy, report, parentReport, currentDate]);

const selectedParticipants = unknownUserDetails ? [unknownUserDetails] : getMoneyRequestParticipantsFromReport(report);
const participants = selectedParticipants.map((participant) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ function ReportActionCompose({
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const personalDetails = usePersonalDetails();
const [blockedFromConcierge] = useOnyx(ONYXKEYS.NVP_BLOCKED_FROM_CONCIERGE, {canBeMissing: true});
const [currentDate] = useOnyx(ONYXKEYS.CURRENT_DATE, {canBeMissing: true});
const [shouldShowComposeInput = true] = useOnyx(ONYXKEYS.SHOULD_SHOW_COMPOSE_INPUT, {canBeMissing: true});
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`, {canBeMissing: true});
const [newParentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`, {canBeMissing: true});
Expand Down Expand Up @@ -492,6 +493,7 @@ function ReportActionCompose({
newIouRequestType: CONST.IOU.REQUEST_TYPE.SCAN,
report,
parentReport: newParentReport,
currentDate,
});

files.forEach((file, index) => {
Expand Down
5 changes: 4 additions & 1 deletion src/pages/iou/request/IOURequestStartPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ function IOURequestStartPage({
canBeMissing: true,
});
const [isMultiScanEnabled, setIsMultiScanEnabled] = useState((optimisticTransactions ?? []).length > 1);
const [currentDate] = useOnyx(ONYXKEYS.CURRENT_DATE, {canBeMissing: true});

const tabTitles = {
[CONST.IOU.TYPE.REQUEST]: translate('iou.createExpense'),
Expand Down Expand Up @@ -130,6 +131,7 @@ function IOURequestStartPage({
newIouRequestType: transaction?.iouRequestType,
report,
parentReport,
currentDate,
lastSelectedDistanceRates,
});
// eslint-disable-next-line
Expand All @@ -150,10 +152,11 @@ function IOURequestStartPage({
newIouRequestType: newIOUType,
report,
parentReport,
currentDate,
lastSelectedDistanceRates,
});
},
[transaction?.iouRequestType, reportID, policy, isFromGlobalCreate, report, parentReport, lastSelectedDistanceRates],
[transaction?.iouRequestType, reportID, policy, isFromGlobalCreate, report, parentReport, currentDate, lastSelectedDistanceRates],
);

// Clear out the temporary expense if the reportID in the URL has changed from the transaction's reportID.
Expand Down
7 changes: 6 additions & 1 deletion tests/actions/IOUTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5817,9 +5817,11 @@ describe('actions/IOU', () => {
merchant: '(none)',
splitPayerAccountIDs: [3],
};

const currentDate = '2025-04-01';
beforeEach(async () => {
await Onyx.set(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${CONST.IOU.OPTIMISTIC_TRANSACTION_ID}`, null);
await Onyx.merge(`${ONYXKEYS.CURRENT_DATE}`, '2025-04-01');
await Onyx.merge(`${ONYXKEYS.CURRENT_DATE}`, currentDate);
await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${fakeReport.reportID}`, fakeReport);
await Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, fakePolicy);
await Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${fakePersonalPolicy.id}`, fakePersonalPolicy);
Expand All @@ -5836,6 +5838,7 @@ describe('actions/IOU', () => {
newIouRequestType: CONST.IOU.REQUEST_TYPE.MANUAL,
report: fakeReport,
parentReport: fakeParentReport,
currentDate,
});
})
.then(async () => {
Expand All @@ -5854,6 +5857,7 @@ describe('actions/IOU', () => {
newIouRequestType: CONST.IOU.REQUEST_TYPE.SCAN,
report: fakeReport,
parentReport: fakeParentReport,
currentDate,
});
})
.then(async () => {
Expand All @@ -5872,6 +5876,7 @@ describe('actions/IOU', () => {
newIouRequestType: CONST.IOU.REQUEST_TYPE.MANUAL,
report: fakeReport,
parentReport: fakeParentReport,
currentDate,
});
})
.then(async () => {
Expand Down
Loading