Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8e22b41
refactor: move Search and submit-expense onto write-readiness barrier…
JakubKorytko Aug 19, 2026
71caa71
fix: drop unused shouldHandleNavigation from splitBill/splitBillAndOp…
JakubKorytko Aug 20, 2026
429ce34
Merge branch 'main' into korytko/writewhenready-cutover
JakubKorytko Sep 8, 2026
4f8d060
fix: remove unused eslint-disable directive
JakubKorytko Sep 8, 2026
94a44fb
fix: notify new action after deferred write starts
JakubKorytko Sep 8, 2026
b8305e1
docs: drop stale deferred-write comments
JakubKorytko Sep 8, 2026
885290a
Merge branch 'main' into korytko/writewhenready-cutover
JakubKorytko Sep 9, 2026
ce8ed44
Merge remote-tracking branch 'eapp/main' into korytko/writewhenready-…
JakubKorytko Sep 9, 2026
8ab4a32
fix: clear pending submit write when the write attaches, not on return
JakubKorytko Sep 9, 2026
1b0e8d5
fix: clear RHP pending submit write when the write attaches
JakubKorytko Sep 9, 2026
fce4a4d
fix: settle pending submit write when no write follows the submit
JakubKorytko Sep 9, 2026
2189557
refactor: drop unreachable pending-write clear in RHP fallback
JakubKorytko Sep 9, 2026
3ecfaa4
fix: scope pending submit write timeout restart to its submission
JakubKorytko Sep 9, 2026
40b741c
Merge remote-tracking branch 'eapp/main' into korytko/writewhenready-…
JakubKorytko Sep 10, 2026
7f48280
Merge branch 'main' into korytko/writewhenready-cutover
JakubKorytko Sep 11, 2026
1604ac7
style: fix import order after merge
JakubKorytko Sep 11, 2026
85dec99
fix: notify invoice room once the SendInvoice write starts
JakubKorytko Sep 11, 2026
f219a18
fix: notify report once track, per diem and distance writes start
JakubKorytko Sep 11, 2026
09d7e59
Merge branch 'main' into korytko/writewhenready-cutover
jmusial Sep 21, 2026
2b1a66c
Merge branch 'main' into korytko/writewhenready-cutover
JakubKorytko Sep 22, 2026
31e06cc
fix: address writeWhenReady review feedback
JakubKorytko Sep 22, 2026
e57a454
Merge branch 'main' into korytko/writewhenready-cutover
JakubKorytko Sep 24, 2026
8e0a3db
fix: flush deferred writes on inactive app state
JakubKorytko Sep 24, 2026
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
4 changes: 0 additions & 4 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2274,10 +2274,6 @@ const CONST = {
GET_INITIAL_URL_TIMEOUT: 10000,
MIN_SMOOTH_SCROLL_EVENT_THROTTLE: 16,
},
DEFERRED_LAYOUT_WRITE_KEYS: {
SEARCH: 'search',
DISMISS_MODAL: 'dismiss_modal',
},
TELEMETRY: {
CONTEXT_FULLSTORY: 'Fullstory',
CONTEXT_MEMORY: 'Memory',
Expand Down
8 changes: 3 additions & 5 deletions src/components/Search/SearchStaticList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import useStyleUtils from '@hooks/useStyleUtils';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';

import {hasDeferredWrite} from '@libs/deferredLayoutWrite';
import Navigation from '@libs/Navigation/Navigation';
import {hasPendingSearchWrite} from '@libs/pendingSearchWrite';
import {getReportStatusColorStyle, getReportStatusTooltipTranslation, getReportStatusTranslation, isOneTransactionReport} from '@libs/ReportUtils';
import {createAndOpenSearchTransactionThread, getSections, getSortedSections, getValidGroupBy, isCreatedDateType} from '@libs/SearchUIUtils';
import {isDeletedTransaction} from '@libs/TransactionUtils';
Expand Down Expand Up @@ -88,9 +88,7 @@ function SearchStaticList({
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
const [rules] = useOnyx(ONYXKEYS.COLLECTION.RULE);

const [showPendingExpensePlaceholder, setShowPendingExpensePlaceholder] = useState(
() => hasDeferredWrite(CONST.DEFERRED_LAYOUT_WRITE_KEYS.SEARCH) || Navigation.getIsFullscreenPreInsertedUnderRHP(),
);
const [showPendingExpensePlaceholder, setShowPendingExpensePlaceholder] = useState(() => hasPendingSearchWrite() || Navigation.getIsFullscreenPreInsertedUnderRHP());

const {type, sortBy, sortOrder, groupBy} = queryJSON;
const validGroupBy = getValidGroupBy(groupBy);
Expand Down Expand Up @@ -125,7 +123,7 @@ function SearchStaticList({
// the destination is visible (focus signal for the dual-gate span ending).
useFocusEffect(
useCallback(() => {
const hasPendingWrite = hasDeferredWrite(CONST.DEFERRED_LAYOUT_WRITE_KEYS.SEARCH);
const hasPendingWrite = hasPendingSearchWrite();
if (!showPendingExpensePlaceholder && hasPendingWrite) {
setShowPendingExpensePlaceholder(true);
} else if (showPendingExpensePlaceholder && !hasPendingWrite && sortedData.length > 0) {
Expand Down
14 changes: 7 additions & 7 deletions src/components/Search/hooks/useOptimisticSearchTracking.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {SearchQueryJSON} from '@components/Search/types';

import {flushDeferredWrite, getOptimisticWatchKey, hasDeferredWrite} from '@libs/deferredLayoutWrite';
import {flushPendingSearchWrite, getSearchWriteWatchKey, hasPendingSearchWrite} from '@libs/pendingSearchWrite';
import {getOriginalMessage, isMoneyRequestAction} from '@libs/ReportActionsUtils';
import {isSearchDataLoaded, isTransactionSearchType} from '@libs/SearchUIUtils';
import {getPendingSubmitFollowUpAction} from '@libs/telemetry/submitFollowUpAction';
Expand Down Expand Up @@ -42,8 +42,8 @@ type UseOptimisticSearchTrackingParams = {
function useOptimisticSearchTracking({searchResults, queryJSON, transactions, reportActions}: UseOptimisticSearchTrackingParams) {
const {type} = queryJSON;

const hasPendingWriteOnMount = hasDeferredWrite(CONST.DEFERRED_LAYOUT_WRITE_KEYS.SEARCH);
const initialWatchKey = getOptimisticWatchKey(CONST.DEFERRED_LAYOUT_WRITE_KEYS.SEARCH);
const hasPendingWriteOnMount = hasPendingSearchWrite();
const initialWatchKey = getSearchWriteWatchKey();

const mutableRef = useRef<TrackingMutableState>({
hasPendingWriteOnMount,
Expand Down Expand Up @@ -88,7 +88,7 @@ function useOptimisticSearchTracking({searchResults, queryJSON, transactions, re
useEffect(
() => () => {
if (getPendingSubmitFollowUpAction()?.followUpAction !== CONST.TELEMETRY.SUBMIT_FOLLOW_UP_ACTION.NAVIGATE_TO_SEARCH) {
flushDeferredWrite(CONST.DEFERRED_LAYOUT_WRITE_KEYS.SEARCH);
flushPendingSearchWrite();
}
if (mutableRef.current.rollbackTimeout) {
clearTimeout(mutableRef.current.rollbackTimeout);
Expand All @@ -110,7 +110,7 @@ function useOptimisticSearchTracking({searchResults, queryJSON, transactions, re
// Step 1: resolve watch key if not yet available.
if (!optimisticWatchKey) {
const cleanup = resolveWatchKey(tracking, setOptimisticWatchKey);
if (!cleanup && !hasDeferredWrite(CONST.DEFERRED_LAYOUT_WRITE_KEYS.SEARCH)) {
if (!cleanup && !hasPendingSearchWrite()) {
clearOptimisticTracking();
}
return cleanup;
Expand Down Expand Up @@ -186,7 +186,7 @@ function useOptimisticSearchTracking({searchResults, queryJSON, transactions, re

/**
* Re-arms optimistic tracking for subsequent expense creations while Search
* stays mounted. Called from useFocusEffect when hasDeferredWrite is detected
* stays mounted. Called from useFocusEffect when hasPendingWrite is detected
* on re-focus.
*
* Safe to call setState here: useFocusEffect only fires while the component
Expand All @@ -200,7 +200,7 @@ function useOptimisticSearchTracking({searchResults, queryJSON, transactions, re
tracking.cachedOptimisticItem = null;
setIsOptimisticTrackingCleared(false);
setShowPendingExpensePlaceholder(true);
const latestKey = getOptimisticWatchKey(CONST.DEFERRED_LAYOUT_WRITE_KEYS.SEARCH);
const latestKey = getSearchWriteWatchKey();
tracking.optimisticWatchKey = latestKey;
setOptimisticWatchKey(latestKey);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {SearchListItem, TransactionListItemType} from '@components/Search/SearchList/ListItem/types';

import {getOptimisticWatchKey, hasDeferredWrite} from '@libs/deferredLayoutWrite';
import {getSearchWriteWatchKey, hasPendingSearchWrite} from '@libs/pendingSearchWrite';

import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
Expand All @@ -11,14 +11,14 @@ import type {OnyxKey} from 'react-native-onyx';
import {useEffect, useState} from 'react';

/**
* Resolves the optimistic watch key from the deferred write channel and
* Looks up the Onyx key of the optimistic item created by the pending Search write and
* synchronizes the mutable ref + React state via requestAnimationFrame.
*
* Returns a cleanup function (to cancel the rAF) when a key is found, or
* `undefined` when no key is available yet.
*/
function resolveWatchKey(tracking: TrackingMutableState, setOptimisticWatchKey: React.Dispatch<React.SetStateAction<OnyxKey | undefined>>): (() => void) | undefined {
const latestKey = getOptimisticWatchKey(CONST.DEFERRED_LAYOUT_WRITE_KEYS.SEARCH);
const latestKey = getSearchWriteWatchKey();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolves the optimistic watch key from the deferred write channel and

Function docs could be updated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

valid, updated to:

Looks up the Onyx key of the optimistic item created by the pending Search write and

if (!latestKey) {
return undefined;
}
Expand Down Expand Up @@ -103,7 +103,7 @@ function useStableOptimisticSortedData(sortedData: SearchListItem[], searchResul

if (!tracking.optimisticWatchKey) {
const cleanup = resolveWatchKey(tracking, setOptimisticWatchKey);
if (!cleanup && !hasDeferredWrite(CONST.DEFERRED_LAYOUT_WRITE_KEYS.SEARCH)) {
if (!cleanup && !hasPendingSearchWrite()) {
clearOptimisticTracking();
}
return cleanup;
Expand Down
18 changes: 9 additions & 9 deletions src/components/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ import {turnOffMobileSelectionMode} from '@libs/actions/MobileSelectionMode';
import {saveLastSearchParams} from '@libs/actions/ReportNavigation';
import type {TransactionPreviewData} from '@libs/actions/Search';
import {setOptimisticDataForTransactionThreadPreview} from '@libs/actions/Search';
import {flushDeferredWrite, hasDeferredWrite} from '@libs/deferredLayoutWrite';
import Log from '@libs/Log';
import isSearchTopmostFullScreenRoute from '@libs/Navigation/helpers/isSearchTopmostFullScreenRoute';
import openInternalRouteInNewTab, {isModifiedMousePress} from '@libs/Navigation/helpers/openInternalRouteInNewTab';
import type {ModifiedMouseEvent} from '@libs/Navigation/helpers/openInternalRouteInNewTab';
import type {PlatformStackNavigationProp} from '@libs/Navigation/PlatformStackNavigation/types';
import TransitionTracker from '@libs/Navigation/TransitionTracker';
import {flushPendingSearchWrite, hasPendingSearchWrite} from '@libs/pendingSearchWrite';
import {isCreatedTaskReportAction} from '@libs/ReportActionsUtils';
import {isOneTransactionReport} from '@libs/ReportUtils';
import {searchKeyToSavedSearchID} from '@libs/SearchKeyUtils';
Expand Down Expand Up @@ -439,9 +439,9 @@ function Search({
// When mounting after the pre-insert fast path, the deferred write hasn't
// been flushed yet. Triggering a search now would race with the CREATE
// API call and return stale results that overwrite the optimistic row.
// Skip this call; the optimistic data from flushDeferredWrite will populate
// Skip this call; the optimistic data from the pending Search write will populate
// the list, and the next user-driven search will refresh from the server.
if (hasPendingWriteOnMountRef.current.hasPendingWriteOnMount && hasDeferredWrite(CONST.DEFERRED_LAYOUT_WRITE_KEYS.SEARCH)) {
if (hasPendingWriteOnMountRef.current.hasPendingWriteOnMount && hasPendingSearchWrite()) {
return;
}

Expand Down Expand Up @@ -912,7 +912,7 @@ function Search({
endNavigateToReportsFirstPaint(CONST.TELEMETRY.NAVIGATE_TO_REPORTS_START_TYPE.WARM_FIRST);
endNavigateToReportsContentLoad();
TransitionTracker.runAfterTransitions({
callback: () => flushDeferredWrite(CONST.DEFERRED_LAYOUT_WRITE_KEYS.SEARCH),
callback: () => flushPendingSearchWrite(),
});
}, [onDestinationVisible]);

Expand Down Expand Up @@ -954,11 +954,11 @@ function Search({
// different component" warning. setIsSearchReady is idempotent, so
// firing this on every bail-out render is safe.
onContentReady?.();
if (!hasDeferredWrite(CONST.DEFERRED_LAYOUT_WRITE_KEYS.SEARCH)) {
if (!hasPendingSearchWrite()) {
return;
}
didBailToFallbackState.current = false;
flushDeferredWrite(CONST.DEFERRED_LAYOUT_WRITE_KEYS.SEARCH);
flushPendingSearchWrite();
});

const onLayoutChart = useCallback(() => {
Expand Down Expand Up @@ -986,7 +986,7 @@ function Search({

// Re-arm pending expense skeleton for subsequent creations while Search
// stays mounted (the original hasPendingWriteOnMountRef only covers the first).
if (hasDeferredWrite(CONST.DEFERRED_LAYOUT_WRITE_KEYS.SEARCH) && !showPendingExpensePlaceholder) {
if (hasPendingSearchWrite() && !showPendingExpensePlaceholder) {
wasRearmedRef.current = true;
rearmTracking();
setSkeletonWasDisplayed(true);
Expand All @@ -999,7 +999,7 @@ function Search({
endNavigateToReportsFirstPaint(CONST.TELEMETRY.NAVIGATE_TO_REPORTS_START_TYPE.WARM_SUBSEQUENT);
endNavigateToReportsContentLoad();
// On re-focus (e.g. DISMISS_MODAL_ONLY) onLayout won't re-fire — flush here.
flushDeferredWrite(CONST.DEFERRED_LAYOUT_WRITE_KEYS.SEARCH);
flushPendingSearchWrite();
}, [shouldShowLoadingState, onDestinationVisible, showPendingExpensePlaceholder, rearmTracking]),
);

Expand All @@ -1009,7 +1009,7 @@ function Search({
// write channel is gone (write executed) and sortedData has updated, then
// signals overlay readiness.
useEffect(() => {
if (!wasRearmedRef.current || hasDeferredWrite(CONST.DEFERRED_LAYOUT_WRITE_KEYS.SEARCH)) {
if (!wasRearmedRef.current || hasPendingSearchWrite()) {
return;
}
wasRearmedRef.current = false;
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/useSearchOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import {useSession} from '@components/OnyxListItemProvider';
import SearchStaticList from '@components/Search/SearchStaticList';
import type {SearchQueryJSON} from '@components/Search/types';

import {hasDeferredWrite} from '@libs/deferredLayoutWrite';
import Navigation from '@libs/Navigation/Navigation';
import {hasPendingSearchWrite} from '@libs/pendingSearchWrite';
import {isDefaultExpensesQuery, queryHasViolationFilter} from '@libs/SearchQueryUtils';
import {getColumnsToShow, getValidGroupBy, isTransactionSearchType} from '@libs/SearchUIUtils';

Expand Down Expand Up @@ -71,7 +71,7 @@ function useSearchOverlay({
const isVendorColumnAvailable = useIsVendorColumnAvailable();
const {policyForMovingExpensesID} = usePolicyForMovingExpenses();

const [isSearchReady, setIsSearchReady] = useState(() => !hasDeferredWrite(CONST.DEFERRED_LAYOUT_WRITE_KEYS.SEARCH) && !Navigation.getIsFullscreenPreInsertedUnderRHP());
const [isSearchReady, setIsSearchReady] = useState(() => !hasPendingSearchWrite() && !Navigation.getIsFullscreenPreInsertedUnderRHP());

const onSearchContentReady = () => {
setIsSearchReady(true);
Expand All @@ -81,7 +81,7 @@ function useSearchOverlay({
// (e.g. a subsequent submit flow while Search stays mounted).
useFocusEffect(
useCallback(() => {
const hasPending = hasDeferredWrite(CONST.DEFERRED_LAYOUT_WRITE_KEYS.SEARCH);
const hasPending = hasPendingSearchWrite();
const hasPreInserted = Navigation.getIsFullscreenPreInsertedUnderRHP();
if (!hasPending && !hasPreInserted) {
return;
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useSearchPageSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {SearchQueryJSON} from '@components/Search/types';

import {saveLastSearchParams} from '@libs/actions/ReportNavigation';
import {openSearch, search} from '@libs/actions/Search';
import {hasDeferredWrite} from '@libs/deferredLayoutWrite';
import {hasPendingSearchWrite} from '@libs/pendingSearchWrite';
import {isSearchDataLoaded, isSearchPending} from '@libs/SearchUIUtils';

import CONST from '@src/CONST';
Expand Down Expand Up @@ -93,7 +93,7 @@ function useSearchPageSetup(queryJSON: Readonly<SearchQueryJSON> | undefined) {
return;
}

const shouldSkipWaitForWrites = hasDeferredWrite(CONST.DEFERRED_LAYOUT_WRITE_KEYS.SEARCH);
const shouldSkipWaitForWrites = hasPendingSearchWrite();
requestedHashesRef.current.add(hash);
search({queryJSON, searchKey: currentSearchKey, offset: 0, shouldCalculateTotals, isLoading: false, skipWaitForWrites: shouldSkipWaitForWrites, shouldSaveRecentSearch: true});
}, [hash, isOffline, shouldUseLiveData, queryJSON, isSnapshotDataLoaded, isSnapshotSearchLoading, isInitialSearchPending, currentSearchKey, shouldCalculateTotals]);
Expand Down
13 changes: 7 additions & 6 deletions src/libs/API/writeWhenReady.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type WriteWhenReadyOptions = {
/** Fires only after `write()` has been called and returned without throwing. A throwing handler is logged, not thrown. */
onWriteStarted?: () => void;

/** Whether READs wait for this write. Defaults to `true`.*/
/** Whether READs wait for this write. Defaults to `true`. */
shouldClaimReadGate?: boolean;
};

Expand All @@ -48,9 +48,10 @@ function registerBackgroundFlushListener() {
}
hasRegisteredBackgroundFlushListener = true;

// Only `background` (not the transient `inactive`) is the last event before the OS can suspend the process.
// Flush on `inactive` as well as `background`: killing the app from the iOS app switcher may not deliver a
// `background` event to JS in time, so `inactive` can be the last chance to persist the write to the queue.
AppState.addEventListener('change', (nextState) => {
if (nextState !== CONST.APP_STATE.BACKGROUND || pendingWrites.size === 0) {
if ((nextState !== CONST.APP_STATE.BACKGROUND && nextState !== CONST.APP_STATE.INACTIVE) || pendingWrites.size === 0) {
return;
}
Log.info(`[API] App going to "${nextState}" - flushing ${pendingWrites.size} pending writeWhenReady write(s)`, false);
Expand Down Expand Up @@ -127,7 +128,7 @@ function armTransitionBarrier(waitFor: true | 'navigation' = true): ArmedTransit
* Caution:
* - The default barrier waits for any transition (~2s worst case if none starts). Pass
* `createTransitionBarrier('navigation')` to gate on a screen transition only, or a custom barrier.
* - We best-effort flush pending writes when the app backgrounds, but there's no flush on a hard
* - We best-effort flush pending writes when the app goes inactive or to the background, but there's no flush on a hard
* kill or crash - a deferred write can simply be lost. Don't defer writes where losing one would
* leave something unrecoverable or hard to reconcile; losing one that's merely annoying to redo
* is an acceptable risk.
Expand Down Expand Up @@ -215,8 +216,8 @@ function writeWhenReady<TCommand extends WriteCommand, TKey extends OnyxKey>(
registerBackgroundFlushListener();
flushOnBackground = () => execute('appBackground');

// The AppState listener only catches new transitions, so an app already in the background when the write is queued must flush here directly.
if (AppState.currentState === CONST.APP_STATE.BACKGROUND) {
// The AppState listener only catches new transitions, so an app already inactive or backgrounded when the write is queued must flush here directly.
if (AppState.currentState === CONST.APP_STATE.BACKGROUND || AppState.currentState === CONST.APP_STATE.INACTIVE) {
execute('appBackground');
return;
}
Expand Down
9 changes: 4 additions & 5 deletions src/libs/IOUAmountSubmission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,17 +313,16 @@ function submitSkipConfirmationPayment(args: SubmitAmountArgs, ctx: SubmitAmount
getCurrencyDecimals,
};

const executeSendMoneyWrite = (overrides?: {shouldDeferForSearch?: boolean}) => {
const mergedParams = {...sendMoneyParams, ...overrides};
const executeSendMoneyWrite = () => {
if (paymentMethod === CONST.IOU.PAYMENT_TYPE.EXPENSIFY) {
sendMoneyWithWallet(mergedParams);
sendMoneyWithWallet(sendMoneyParams);
} else {
sendMoneyElsewhere(mergedParams);
sendMoneyElsewhere(sendMoneyParams);
}
};

submitWithDismissFirst({
executeWrite: () => executeSendMoneyWrite({shouldDeferForSearch: false}),
executeWrite: executeSendMoneyWrite,
destinationReportID: chatReportID,
telemetryContext: {
scenario: CONST.TELEMETRY.SUBMIT_EXPENSE_SCENARIO.SEND_MONEY,
Expand Down
10 changes: 5 additions & 5 deletions src/libs/MoneyRequestReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {isEmptyObject} from '@src/types/utils/EmptyObject';
import type {OnyxCollection, OnyxEntry} from 'react-native-onyx';
import type {ValueOf} from 'type-fest';

import {hasDeferredWriteForReport} from './deferredLayoutWrite';
import {hasPendingSubmitWriteForReport} from './pendingSubmitWrite';
import {isPaidGroupPolicy} from './PolicyUtils';
import {getIOUActionForTransactionID, getOriginalMessage, isDeletedAction, isDeletedParentAction, isMoneyRequestAction} from './ReportActionsUtils';
import {
Expand Down Expand Up @@ -157,10 +157,10 @@ function shouldWaitForTransactions(

const isTransactionDataReady = transactions !== undefined;
const isTransactionThreadView = isReportTransactionThread(report);
// Scope the dismiss-write check to *this* report so an unrelated submit flow that's
// mid-dismiss doesn't make every empty money-request/invoice report look like it's loading.
const hasPendingDismissWrite = hasDeferredWriteForReport(CONST.DEFERRED_LAYOUT_WRITE_KEYS.DISMISS_MODAL, report?.reportID);
const isStillLoadingData = transactions?.length === 0 && ((isReportLoadPending && !reportLoadingState?.hasOnceLoadedReportActions) || report?.total !== 0 || hasPendingDismissWrite);
// Scope the pending-submit-write check to *this* report so an unrelated submit flow that's
// mid-submit doesn't make every empty money-request/invoice report look like it's loading.
const hasPendingSubmitWrite = hasPendingSubmitWriteForReport(report?.reportID);
const isStillLoadingData = transactions?.length === 0 && ((isReportLoadPending && !reportLoadingState?.hasOnceLoadedReportActions) || report?.total !== 0 || hasPendingSubmitWrite);
return (
(isMoneyRequestReport(report) || isInvoiceReport(report)) &&
(!isTransactionDataReady || isStillLoadingData) &&
Expand Down
Loading
Loading