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
16 changes: 10 additions & 6 deletions config/eslint/eslint.seatbelt.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"../../src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx" "@typescript-eslint/no-deprecated/InteractionManager.runAfterInteractions" 3
"../../src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx" "react-hooks/refs" 6
"../../src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx" "react-hooks/set-state-in-effect" 3
"../../src/components/MoneyRequestReportView/MoneyRequestReportView.tsx" "@typescript-eslint/no-deprecated/InteractionManager.runAfterInteractions" 1
"../../src/components/MultiGestureCanvas/index.tsx" "no-restricted-syntax" 1
"../../src/components/MultiGestureCanvas/index.tsx" "react-hooks/preserve-manual-memoization" 1
"../../src/components/MultiGestureCanvas/index.tsx" "react-hooks/refs" 2
Expand Down Expand Up @@ -208,7 +209,7 @@
"../../src/hooks/useDialogContainerFocus/index.ts" "@typescript-eslint/no-deprecated/InteractionManager.runAfterInteractions" 1
"../../src/hooks/useDomainGroupFilter.ts" "react-hooks/set-state-in-effect" 1
"../../src/hooks/useDragAndDrop/types.ts" "@typescript-eslint/no-deprecated/React.MutableRefObject" 1
"../../src/hooks/useExpenseActions.ts" "@typescript-eslint/no-deprecated/InteractionManager.runAfterInteractions" 2
"../../src/hooks/useExpenseActions.ts" "@typescript-eslint/no-deprecated/InteractionManager.runAfterInteractions" 3
"../../src/hooks/useFilesValidation.tsx" "@typescript-eslint/no-deprecated/ConfirmModal" 1
"../../src/hooks/useInitial.ts" "react-hooks/refs" 4
"../../src/hooks/useIsBlockedToAddFeed.ts" "react-hooks/set-state-in-effect" 1
Expand Down Expand Up @@ -386,19 +387,20 @@
"../../src/libs/actions/ReimbursementAccount/resetNonUSDBankAccount.ts" "no-restricted-syntax" 1
"../../src/libs/actions/ReimbursementAccount/resetUSDBankAccount.ts" "no-restricted-syntax" 1
"../../src/libs/actions/Report/MarkAllMessageAsRead.tsx" "no-restricted-syntax" 1
"../../src/libs/actions/Report/index.ts" "@typescript-eslint/no-deprecated/InteractionManager.runAfterInteractions" 1
"../../src/libs/actions/Report/index.ts" "@typescript-eslint/no-deprecated/InteractionManager.runAfterInteractions" 2
"../../src/libs/actions/Report/index.ts" "@typescript-eslint/no-deprecated/buildNextStepNew" 3
"../../src/libs/actions/Report/index.ts" "@typescript-eslint/no-deprecated/reportAction.originalMessage" 1
"../../src/libs/actions/Report/index.ts" "no-restricted-syntax" 10
"../../src/libs/actions/Report/index.ts" "rulesdir/no-onyx-connect" 4
"../../src/libs/actions/ReportLayout.ts" "no-restricted-syntax" 1
"../../src/libs/actions/ScheduleCall.ts" "no-restricted-syntax" 1
"../../src/libs/actions/Search.ts" "no-restricted-syntax" 1
"../../src/libs/actions/Session/index.ts" "no-restricted-imports" 1
"../../src/libs/actions/Session/index.ts" "@typescript-eslint/no-deprecated/InteractionManager.runAfterInteractions" 1
"../../src/libs/actions/Session/index.ts" "no-restricted-syntax" 9
"../../src/libs/actions/Session/index.ts" "rulesdir/no-onyx-connect" 2
"../../src/libs/actions/StatsCounter.ts" "no-restricted-syntax" 2
"../../src/libs/actions/Subscription.ts" "no-restricted-syntax" 1
"../../src/libs/actions/Task.ts" "@typescript-eslint/no-deprecated/InteractionManager.runAfterInteractions" 1
"../../src/libs/actions/Task.ts" "no-restricted-syntax" 7
"../../src/libs/actions/TaxRate.ts" "no-restricted-syntax" 1
"../../src/libs/actions/TeachersUnite.ts" "no-restricted-syntax" 1
Expand Down Expand Up @@ -464,7 +466,7 @@
"../../src/pages/RoomMembersPage.tsx" "react-hooks/set-state-in-effect" 1
"../../src/pages/ScheduleCall/ScheduleCallPage.tsx" "react-hooks/preserve-manual-memoization" 1
"../../src/pages/Search/SearchAdvancedFiltersPage/SearchFiltersCardPage.tsx" "react-hooks/set-state-in-effect" 1
"../../src/pages/Search/SearchMoneyRequestReportPage.tsx" "no-restricted-imports" 1
"../../src/pages/Search/SearchMoneyRequestReportPage.tsx" "@typescript-eslint/no-deprecated/InteractionManager.runAfterInteractions" 1
"../../src/pages/Search/SearchPage.tsx" "react-hooks/set-state-in-effect" 1
"../../src/pages/Search/SearchTransactionsChangeReport.tsx" "@typescript-eslint/no-deprecated/InteractionManager.runAfterInteractions" 1
"../../src/pages/Share/ShareRootPage.tsx" "@typescript-eslint/no-deprecated/InteractionManager.runAfterInteractions" 1
Expand All @@ -473,12 +475,13 @@
"../../src/pages/ValidateLoginPage/index.web.tsx" "react-hooks/set-state-in-effect" 1
"../../src/pages/domain/Groups/PreferredWorkspaceToggle.tsx" "@typescript-eslint/no-deprecated/ConfirmModal" 1
"../../src/pages/domain/Saml/SamlLoginSectionContent.tsx" "@typescript-eslint/no-deprecated/ConfirmModal" 1
"../../src/pages/inbox/DeleteTransactionNavigateBackHandler.tsx" "no-restricted-imports" 1
"../../src/pages/inbox/DeleteTransactionNavigateBackHandler.tsx" "@typescript-eslint/no-deprecated/InteractionManager.runAfterInteractions" 1
"../../src/pages/inbox/ReportFetchHandler.tsx" "@typescript-eslint/no-deprecated/InteractionManager.runAfterInteractions" 2
"../../src/pages/inbox/ReportNavigateAwayHandler.tsx" "react-hooks/exhaustive-deps" 1
"../../src/pages/inbox/hooks/useDeferNonEssentials.ts" "no-restricted-imports" 2
"../../src/pages/inbox/hooks/useFlushDeferredWriteOnFocus.ts" "no-restricted-imports" 1
"../../src/pages/inbox/hooks/useReportWasDeleted.ts" "react-hooks/set-state-in-effect" 1
"../../src/pages/inbox/report/ContextMenu/BaseReportActionContextMenu.tsx" "@typescript-eslint/no-deprecated/InteractionManager.runAfterInteractions" 1
"../../src/pages/inbox/report/ContextMenu/BaseReportActionContextMenu.tsx" "react-hooks/preserve-manual-memoization" 1
"../../src/pages/inbox/report/ContextMenu/BaseReportActionContextMenu.tsx" "react-hooks/refs" 1
"../../src/pages/inbox/report/ContextMenu/PopoverReportActionContextMenu.tsx" "@typescript-eslint/no-deprecated/ConfirmModal" 1
Expand All @@ -495,7 +498,7 @@
"../../src/pages/inbox/report/ReportActionItemMessageEdit.tsx" "react-hooks/preserve-manual-memoization" 1
"../../src/pages/inbox/report/ReportActionItemMessageEdit.tsx" "react-hooks/refs" 5
"../../src/pages/inbox/report/ReportActionItemMessageEdit.tsx" "react-hooks/set-state-in-effect" 1
"../../src/pages/inbox/report/ReportActionsList.tsx" "no-restricted-imports" 1
"../../src/pages/inbox/report/ReportActionsList.tsx" "@typescript-eslint/no-deprecated/InteractionManager.runAfterInteractions" 4
"../../src/pages/inbox/report/ReportActionsList.tsx" "react-hooks/refs" 5
"../../src/pages/inbox/report/ReportActionsList.tsx" "react-hooks/set-state-in-effect" 3
"../../src/pages/inbox/report/TripSummary.tsx" "rulesdir/no-default-id-values" 1
Expand Down Expand Up @@ -624,6 +627,7 @@
"../../src/pages/workspace/companyCards/WorkspaceVerifyWorkAccountPage.tsx" "react-hooks/set-state-in-effect" 1
"../../src/pages/workspace/companyCards/addNew/DynamicAddNewCardPage.tsx" "@typescript-eslint/no-deprecated/ConfirmModal" 1
"../../src/pages/workspace/companyCards/addNew/PlaidConnectionStep.tsx" "@typescript-eslint/no-deprecated/InteractionManager.runAfterInteractions" 1
"../../src/pages/workspace/companyCards/assignCard/ConfirmationStep.tsx" "@typescript-eslint/no-deprecated/InteractionManager.runAfterInteractions" 1
"../../src/pages/workspace/distanceRates/PolicyDistanceRatesPage.tsx" "react-hooks/preserve-manual-memoization" 1
"../../src/pages/workspace/downgrade/WorkspaceDowngradePage.tsx" "@typescript-eslint/no-deprecated/ConfirmModal" 1
"../../src/pages/workspace/downgrade/WorkspaceDowngradePage.tsx" "@typescript-eslint/no-deprecated/InteractionManager.runAfterInteractions" 2
Expand Down
2 changes: 1 addition & 1 deletion src/components/MoneyRequestHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type MoneyRequestHeaderProps = {
reportID: string | undefined;

/** Method to trigger when pressing close button of the header */
onBackButtonPress: (prioritizeBackTo?: boolean, options?: {afterTransition?: () => void}) => void;
onBackButtonPress: (prioritizeBackTo?: boolean) => void;
};

function MoneyRequestHeader({reportID: reportIDProp, onBackButtonPress}: MoneyRequestHeaderProps) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/MoneyRequestHeaderActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type MoneyRequestHeaderActionsProps = {
reportID: string | undefined;

/** Method to trigger when pressing close button of the header */
onBackButtonPress: (prioritizeBackTo?: boolean, options?: {afterTransition?: () => void}) => void;
onBackButtonPress: (prioritizeBackTo?: boolean) => void;
};

function MoneyRequestHeaderActions({reportID, onBackButtonPress}: MoneyRequestHeaderActionsProps) {
Expand Down
15 changes: 8 additions & 7 deletions src/components/MoneyRequestHeaderSecondaryActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {shouldFailAllRequestsSelector} from '@selectors/Network';
import {hasSeenTourSelector} from '@selectors/Onboarding';
import {validTransactionDraftsSelector} from '@selectors/TransactionDraft';
import React, {useRef, useState} from 'react';
// eslint-disable-next-line no-restricted-imports
import {InteractionManager} from 'react-native';
import type {ValueOf} from 'type-fest';
import useConfirmModal from '@hooks/useConfirmModal';
import {useCurrencyListActions} from '@hooks/useCurrencyList';
Expand Down Expand Up @@ -82,7 +84,7 @@ type MoneyRequestHeaderSecondaryActionsProps = {
reportID: string | undefined;

/** Method to trigger when pressing close button of the header */
onBackButtonPress: (prioritizeBackTo?: boolean, options?: {afterTransition?: () => void}) => void;
onBackButtonPress: (prioritizeBackTo?: boolean) => void;
};

function MoneyRequestHeaderSecondaryActions({reportID, onBackButtonPress}: MoneyRequestHeaderSecondaryActionsProps) {
Expand Down Expand Up @@ -443,8 +445,6 @@ function MoneyRequestHeaderSecondaryActions({reportID, onBackButtonPress}: Money
}
const backToRoute = route.params?.backTo ?? Navigation.getActiveRoute();
setDeleteTransactionNavigateBackUrl(backToRoute);

let afterDelete: (() => void) | undefined;
if (isTrackExpenseAction(parentReportAction) && !isExpenseSplit) {
deleteTrackExpense({
chatReportID: report?.parentReportID,
Expand All @@ -467,7 +467,8 @@ function MoneyRequestHeaderSecondaryActions({reportID, onBackButtonPress}: Money
deleteTransactions([transaction.transactionID], duplicateTransactions, duplicateTransactionViolations, currentSearchHash, true);
return;
}
afterDelete = () => {
// eslint-disable-next-line @typescript-eslint/no-deprecated
InteractionManager.runAfterInteractions(() => {
const deleteResult = deleteTransactions(
[transaction.transactionID],
duplicateTransactions,
Expand All @@ -481,14 +482,14 @@ function MoneyRequestHeaderSecondaryActions({reportID, onBackButtonPress}: Money
}

removeTransaction(transaction.transactionID);
};
});
}
if (isInNarrowPaneModal) {
Navigation.navigateBackToLastSuperWideRHPScreen({afterTransition: afterDelete});
Navigation.navigateBackToLastSuperWideRHPScreen();
return;
}

onBackButtonPress(false, {afterTransition: afterDelete});
onBackButtonPress();
});
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// We use Animated for all functionality related to wide RHP to make it easier
// to interact with react-navigation components (e.g., CardContainer, interpolator), which also use Animated.
// eslint-disable-next-line no-restricted-imports
import {Animated, ScrollView, View} from 'react-native';
import {Animated, InteractionManager, ScrollView, View} from 'react-native';
import type {LayoutChangeEvent} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
import CollapsibleHeaderOnKeyboard from '@components/CollapsibleHeaderOnKeyboard';
Expand Down Expand Up @@ -61,7 +61,7 @@
onLayout?: (event: LayoutChangeEvent) => void;
};

function goBackFromSearchMoneyRequest(options?: {afterTransition?: () => void}) {
function goBackFromSearchMoneyRequest() {
const rootState = navigationRef.getRootState();
const lastRoute = rootState.routes.at(-1);

Expand All @@ -71,7 +71,7 @@
}

if (lastRoute?.name === NAVIGATORS.RIGHT_MODAL_NAVIGATOR) {
Navigation.goBack(undefined, options);
Navigation.goBack();
return;
}

Expand All @@ -81,11 +81,11 @@
}

if (rootState.routes.length > 1) {
Navigation.goBack(undefined, options);
Navigation.goBack();
return;
}

Navigation.goBack(ROUTES.SEARCH_ROOT.getRoute({query: buildCannedSearchQuery()}), options);
Navigation.goBack(ROUTES.SEARCH_ROOT.getRoute({query: buildCannedSearchQuery()}));
}

function InitialLoadingSkeleton({styles, onLayout, reasonAttributes}: {styles: ThemeStyles; onLayout?: (event: LayoutChangeEvent) => void; reasonAttributes: SkeletonSpanReasonAttributes}) {
Expand Down Expand Up @@ -144,7 +144,8 @@

const isLoadingInitialReportActions = reportLoadingState?.isLoadingInitialReportActions;
const dismissReportCreationError = useCallback(() => {
goBackFromSearchMoneyRequest({afterTransition: () => removeFailedReport(reportID)});
goBackFromSearchMoneyRequest();
InteractionManager.runAfterInteractions(() => removeFailedReport(reportID));

Check failure on line 148 in src/components/MoneyRequestReportView/MoneyRequestReportView.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

`runAfterInteractions` is deprecated
}, [reportID]);

// Special case handling a report that is a transaction thread
Expand Down
14 changes: 4 additions & 10 deletions src/components/SidePanel/SidePanelContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type SidePanelStateContextProps = {

type SidePanelActionsContextProps = {
openSidePanel: () => void;
closeSidePanel: (options?: {afterTransition?: () => void}) => void;
closeSidePanel: () => void;
};

const SidePanelStateContext = createContext<SidePanelStateContextProps>({
Expand Down Expand Up @@ -88,7 +88,6 @@ function SidePanelContextProvider({children}: PropsWithChildren) {

const reportID = (isRHPAdminsRoom || isRHPHomePage) && isUserAdmin && isPolicyActive && adminsChatReportID ? adminsChatReportID : conciergeReportID;

const onCloseCompleteRef = useRef<(() => void) | undefined>(undefined);
const [sessionStartTime, setSessionStartTime] = useState<string | null>(null);
const [prevShouldHideSidePanel, setPrevShouldHideSidePanel] = useState(shouldHideSidePanel);

Expand Down Expand Up @@ -122,22 +121,17 @@ function SidePanelContextProvider({children}: PropsWithChildren) {
duration: CONST.SIDE_PANEL_ANIMATED_TRANSITION,
useNativeDriver: true,
}),
]).start(() => {
setIsSidePanelTransitionEnded(true);
onCloseCompleteRef.current?.();
onCloseCompleteRef.current = undefined;
});
]).start(() => setIsSidePanelTransitionEnded(true));
}, [shouldHideSidePanel, shouldApplySidePanelOffset]);

const closeSidePanel = (options?: {afterTransition?: () => void}) => {
const closeSidePanel = (shouldUpdateNarrow = false) => {
// User shouldn't be able to close side panel if side panel NVP is undefined
if (!sidePanelNVP) {
return;
}

onCloseCompleteRef.current = options?.afterTransition;
setIsSidePanelTransitionEnded(false);
SidePanelActions.closeSidePanel(!isExtraLargeScreenWidth);
SidePanelActions.closeSidePanel(!isExtraLargeScreenWidth || shouldUpdateNarrow);

// Focus the composer after closing the Side Panel
focusComposerWithDelay(ReportActionComposeFocusManager.composerRef.current, CONST.SIDE_PANEL_ANIMATED_TRANSITION + CONST.COMPOSER_FOCUS_DELAY)(true);
Expand Down
2 changes: 1 addition & 1 deletion src/components/SidePanel/SidePanelModal/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type SidePanelModalProps = {
shouldHideSidePanel: boolean;
sidePanelTranslateX: RefObject<Animated.Value>;
shouldHideSidePanelBackdrop: boolean;
closeSidePanel: (options?: {afterTransition?: () => void}) => void;
closeSidePanel: (shouldUpdateNarrow?: boolean) => void;
};

export default SidePanelModalProps;
25 changes: 12 additions & 13 deletions src/hooks/useExpenseActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -550,19 +550,18 @@ function useExpenseActions({reportID, isReportInSearch = false, backTo, onDuplic
setDeleteTransactionNavigateBackUrl(deleteNavigateBackUrl);

Navigation.setNavigationActionToMicrotaskQueue(() => {
Navigation.goBack(backToRoute, {
afterTransition: () => {
deleteAppReport({
report: moneyRequestReport,
selfDMReport,
currentUserEmailParam: email ?? '',
currentUserAccountIDParam: accountID,
reportTransactions,
allTransactionViolations,
bankAccountList,
hash: currentSearchHash,
});
},
Navigation.goBack(backToRoute);
InteractionManager.runAfterInteractions(() => {
deleteAppReport({
report: moneyRequestReport,
selfDMReport,
currentUserEmailParam: email ?? '',
currentUserAccountIDParam: accountID,
reportTransactions,
allTransactionViolations,
bankAccountList,
hash: currentSearchHash,
});
});
});
},
Expand Down
8 changes: 4 additions & 4 deletions src/libs/Navigation/Navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -825,15 +825,15 @@ function dismissModal({ref = navigationRef, afterTransition, waitForTransition}:
const dismissModalWithReport = (
{reportID, reportActionID, referrer, backTo}: ReportsSplitNavigatorParamList[typeof SCREENS.REPORT],
ref = navigationRef,
options?: {onBeforeNavigate?: (willOpenReport: boolean) => void; afterTransition?: () => void},
options?: {onBeforeNavigate?: (willOpenReport: boolean) => void},
) => {
const dismissAndOpenReport = () => {
const topmostSuperWideRHPReportID = getTopmostSuperWideRHPReportID();
let areReportsIDsDefined = !!topmostSuperWideRHPReportID && !!reportID;

if (topmostSuperWideRHPReportID === reportID && areReportsIDsDefined) {
options?.onBeforeNavigate?.(false);
dismissToSuperWideRHP({afterTransition: options?.afterTransition});
dismissToSuperWideRHP();
return;
}

Expand All @@ -842,14 +842,14 @@ const dismissModalWithReport = (
const isReportsSplitTopmostFullScreen = isReportTopmostSplitNavigator();
if (topmostReportID === reportID && areReportsIDsDefined && isReportsSplitTopmostFullScreen) {
options?.onBeforeNavigate?.(false);
dismissModal({afterTransition: options?.afterTransition});
dismissModal();
return;
}
options?.onBeforeNavigate?.(true);
const reportRoute = ROUTES.REPORT_WITH_ID.getRoute(reportID, reportActionID, referrer, backTo);
dismissModal({
afterTransition: () => {
navigate(reportRoute, {afterTransition: options?.afterTransition});
navigate(reportRoute);
},
});
};
Expand Down
Loading
Loading