Skip to content

Commit 0e371ff

Browse files
authored
Merge pull request Expensify#68985 from Expensify/jasper-revert65862
[CP Staging] Revert "Optimistic report name computation"
2 parents 19c98cf + f329441 commit 0e371ff

11 files changed

Lines changed: 2 additions & 2286 deletions

cspell.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@
239239
"formatjs",
240240
"Français",
241241
"Frederico",
242-
"freetext",
243242
"frontpart",
244243
"fullstory",
245244
"FWTV",

src/CONST/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,6 @@ const CONST = {
664664
BETAS: {
665665
ALL: 'all',
666666
ASAP_SUBMIT: 'asapSubmit',
667-
AUTH_AUTO_REPORT_TITLE: 'authAutoReportTitle',
668667
DEFAULT_ROOMS: 'defaultRooms',
669668
P2P_DISTANCE_REQUESTS: 'p2pDistanceRequests',
670669
SPOTNANA_TRAVEL: 'spotnanaTravel',
@@ -1528,9 +1527,6 @@ const CONST = {
15281527
APPLY_AIRSHIP_UPDATES: 'apply_airship_updates',
15291528
APPLY_PUSHER_UPDATES: 'apply_pusher_updates',
15301529
APPLY_HTTPS_UPDATES: 'apply_https_updates',
1531-
COMPUTE_REPORT_NAME: 'compute_report_name',
1532-
COMPUTE_REPORT_NAME_FOR_NEW_REPORT: 'compute_report_name_for_new_report',
1533-
UPDATE_OPTIMISTIC_REPORT_NAMES: 'update_optimistic_report_names',
15341530
COLD: 'cold',
15351531
WARM: 'warm',
15361532
REPORT_ACTION_ITEM_LAYOUT_DEBOUNCE_TIME: 1500,

src/libs/API/index.ts

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import Log from '@libs/Log';
77
import {handleDeletedAccount, HandleUnusedOptimisticID, Logging, Pagination, Reauthentication, RecheckConnection, SaveResponseInOnyx} from '@libs/Middleware';
88
import {isOffline} from '@libs/Network/NetworkStore';
99
import {push as pushToSequentialQueue, waitForIdle as waitForSequentialQueueIdle} from '@libs/Network/SequentialQueue';
10-
import * as OptimisticReportNames from '@libs/OptimisticReportNames';
11-
import {getUpdateContext, initialize as initializeOptimisticReportNamesContext} from '@libs/OptimisticReportNamesConnectionManager';
1210
import Pusher from '@libs/Pusher';
1311
import {processWithMiddleware, use} from '@libs/Request';
1412
import {getAll, getLength as getPersistedRequestsLength} from '@userActions/PersistedRequests';
@@ -17,7 +15,7 @@ import type OnyxRequest from '@src/types/onyx/Request';
1715
import type {PaginatedRequest, PaginationConfig, RequestConflictResolver} from '@src/types/onyx/Request';
1816
import type Response from '@src/types/onyx/Response';
1917
import type {ApiCommand, ApiRequestCommandParameters, ApiRequestType, CommandOfType, ReadCommand, SideEffectRequestCommand, WriteCommand} from './types';
20-
import {READ_COMMANDS, WRITE_COMMANDS} from './types';
18+
import {READ_COMMANDS} from './types';
2119

2220
// Setup API middlewares. Each request made will pass through a series of middleware functions that will get called in sequence (each one passing the result of the previous to the next).
2321
// Note: The ordering here is intentional as we want to Log, Recheck Connection, Reauthenticate, and Save the Response in Onyx. Errors thrown in one middleware will bubble to the next.
@@ -44,11 +42,6 @@ use(Pagination);
4442
// middlewares after this, because the SequentialQueue depends on the result of this middleware to pause the queue (if needed) to bring the app to an up-to-date state.
4543
use(SaveResponseInOnyx);
4644

47-
// Initialize OptimisticReportNames context on module load
48-
initializeOptimisticReportNamesContext().catch(() => {
49-
Log.warn('Failed to initialize OptimisticReportNames context');
50-
});
51-
5245
let requestIndex = 0;
5346

5447
type OnyxData = {
@@ -81,22 +74,7 @@ function prepareRequest<TCommand extends ApiCommand>(
8174
const {optimisticData, ...onyxDataWithoutOptimisticData} = onyxData;
8275
if (optimisticData && shouldApplyOptimisticData) {
8376
Log.info('[API] Applying optimistic data', false, {command, type});
84-
85-
// Process optimistic data through report name middleware
86-
// Skip for OpenReport command to avoid unnecessary processing
87-
if (command === WRITE_COMMANDS.OPEN_REPORT) {
88-
Onyx.update(optimisticData);
89-
} else {
90-
try {
91-
const context = getUpdateContext();
92-
const processedOptimisticData = OptimisticReportNames.updateOptimisticReportNamesFromUpdates(optimisticData, context);
93-
Onyx.update(processedOptimisticData);
94-
} catch (error) {
95-
Log.warn('[API] Failed to process optimistic report names', {error});
96-
// Fallback to original optimistic data if processing fails
97-
Onyx.update(optimisticData);
98-
}
99-
}
77+
Onyx.update(optimisticData);
10078
}
10179

10280
const isWriteRequest = type === CONST.API_REQUEST_TYPE.WRITE;

0 commit comments

Comments
 (0)