Skip to content

Commit 90a6836

Browse files
committed
perf CI check fix
1 parent fbbe61a commit 90a6836

1 file changed

Lines changed: 16 additions & 26 deletions

File tree

src/libs/actions/Report/index.ts

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2162,26 +2162,21 @@ function navigateToAndOpenReport(
21622162
}
21632163

21642164
let hasAttemptedFallback = false;
2165-
let hasSeenLoadingStart = false;
2166-
const loadingStateConnection = Onyx.connectWithoutView({
2167-
key: `${ONYXKEYS.COLLECTION.RAM_ONLY_REPORT_LOADING_STATE}${chat.reportID}`,
2168-
callback: (loadingState) => {
2169-
if (loadingState?.isLoadingInitialReportActions) {
2170-
hasSeenLoadingStart = true;
2165+
const reportConnection = Onyx.connectWithoutView({
2166+
key: `${ONYXKEYS.COLLECTION.REPORT}${chat.reportID}`,
2167+
callback: (updatedReport) => {
2168+
const notFoundError = updatedReport?.errorFields?.notFound;
2169+
if (notFoundError === null) {
2170+
Onyx.disconnect(reportConnection);
21712171
return;
21722172
}
21732173

2174-
if (!hasSeenLoadingStart) {
2175-
return;
2176-
}
2177-
2178-
Onyx.disconnect(loadingStateConnection);
2179-
const latestReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${chat.reportID}`];
2180-
if (!latestReport?.errorFields?.notFound || hasAttemptedFallback) {
2174+
if (!notFoundError || hasAttemptedFallback) {
21812175
return;
21822176
}
21832177

21842178
hasAttemptedFallback = true;
2179+
Onyx.disconnect(reportConnection);
21852180
createAndOpenNewOptimisticChat(chat.reportID);
21862181
},
21872182
});
@@ -2270,26 +2265,21 @@ function navigateToAndOpenReportWithAccountIDs(
22702265
}
22712266

22722267
let hasAttemptedFallback = false;
2273-
let hasSeenLoadingStart = false;
2274-
const loadingStateConnection = Onyx.connectWithoutView({
2275-
key: `${ONYXKEYS.COLLECTION.RAM_ONLY_REPORT_LOADING_STATE}${chat.reportID}`,
2276-
callback: (loadingState) => {
2277-
if (loadingState?.isLoadingInitialReportActions) {
2278-
hasSeenLoadingStart = true;
2279-
return;
2280-
}
2281-
2282-
if (!hasSeenLoadingStart) {
2268+
const reportConnection = Onyx.connectWithoutView({
2269+
key: `${ONYXKEYS.COLLECTION.REPORT}${chat.reportID}`,
2270+
callback: (updatedReport) => {
2271+
const notFoundError = updatedReport?.errorFields?.notFound;
2272+
if (notFoundError === null) {
2273+
Onyx.disconnect(reportConnection);
22832274
return;
22842275
}
22852276

2286-
Onyx.disconnect(loadingStateConnection);
2287-
const latestReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${chat.reportID}`];
2288-
if (!latestReport?.errorFields?.notFound || hasAttemptedFallback) {
2277+
if (!notFoundError || hasAttemptedFallback) {
22892278
return;
22902279
}
22912280

22922281
hasAttemptedFallback = true;
2282+
Onyx.disconnect(reportConnection);
22932283
createAndOpenNewOptimisticChat(chat.reportID);
22942284
},
22952285
});

0 commit comments

Comments
 (0)