Skip to content

Commit f73e5e0

Browse files
add proper fix to reportAttributes instead of fixing test
1 parent 6bb2423 commit f73e5e0

2 files changed

Lines changed: 2 additions & 12 deletions

File tree

src/libs/actions/OnyxDerived/configs/reportAttributes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default createOnyxDerivedValueConfig({
4747
}
4848
// if any of those keys changed, reset the isFullyComputed flag to recompute all reports
4949
// we need to recompute all report attributes on locale change because the report names are locale dependent
50-
if (hasKeyTriggeredCompute(ONYXKEYS.NVP_PREFERRED_LOCALE, sourceValues)) {
50+
if (hasKeyTriggeredCompute(ONYXKEYS.NVP_PREFERRED_LOCALE, sourceValues) || hasKeyTriggeredCompute(ONYXKEYS.PERSONAL_DETAILS_LIST, sourceValues)) {
5151
isFullyComputed = false;
5252
}
5353

tests/unit/ReportUtilsTest.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3141,24 +3141,14 @@ describe('ReportUtils', () => {
31413141
});
31423142

31433143
describe('getMoneyReportPreviewName', () => {
3144-
it('should return the report name if present', async () => {
3144+
it('should return the report name if present', () => {
31453145
const action: ReportAction = {
31463146
...createRandomReportAction(1),
31473147
actionName: CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW,
31483148
};
31493149
const report: Report = {
31503150
...createRandomReport(1),
3151-
type: CONST.REPORT.TYPE.CHAT,
3152-
chatType: CONST.REPORT.CHAT_TYPE.GROUP,
3153-
participants: buildParticipantsFromAccountIDs([1, 2, 3, 4, 5, 6]),
3154-
reportName: '', // Clear the random report name so it uses participant names
31553151
};
3156-
3157-
// Set up the fake personal details and the report in Onyx so derived values work
3158-
await Onyx.merge(ONYXKEYS.PERSONAL_DETAILS_LIST, fakePersonalDetails);
3159-
await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`, report);
3160-
await waitForBatchedUpdates();
3161-
31623152
const result = getMoneyReportPreviewName(action, report);
31633153
expect(result).toBe('Five, Four, One, Three, Two...');
31643154
});

0 commit comments

Comments
 (0)