Skip to content

Commit

Permalink
fixed Delete report navigation reset in Debug Mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ikevin127 committed Jan 4, 2025
1 parent f7d8782 commit 14e28d7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/pages/Debug/Report/DebugReportPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {useCallback, useMemo} from 'react';
import {View} from 'react-native';
import {InteractionManager, View} from 'react-native';
import {useOnyx} from 'react-native-onyx';
import Button from '@components/Button';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
Expand All @@ -10,7 +10,7 @@ import useLocalize from '@hooks/useLocalize';
import useStyleUtils from '@hooks/useStyleUtils';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import {navigateToConciergeChatAndDeleteReport} from '@libs/actions/Report';
import {deleteReport} from '@libs/actions/Report';
import DebugUtils from '@libs/DebugUtils';
import * as DeviceCapabilities from '@libs/DeviceCapabilities';
import type {DebugTabNavigatorRoutes} from '@libs/Navigation/DebugTabNavigator';
Expand Down Expand Up @@ -123,7 +123,12 @@ function DebugReportPage({
Debug.setDebugData(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, data);
}}
onDelete={() => {
navigateToConciergeChatAndDeleteReport(reportID, true, true);
Navigation.resetToHome();
// We need to wait for navigation animations to finish before deleting an action,
// otherwise the user will see a not found page briefly.
InteractionManager.runAfterInteractions(() => {
deleteReport(reportID, true);
});
}}
validate={DebugUtils.validateReportDraftProperty}
>
Expand Down

0 comments on commit 14e28d7

Please sign in to comment.