Skip to content

Commit 3b72a46

Browse files
committed
update code
1 parent 588972a commit 3b72a46

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/pages/Search/SearchMoneyRequestReportPage.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import {createTransactionThreadReport, openReport, updateLastVisitTime} from '@u
4242
import CONST from '@src/CONST';
4343
import ONYXKEYS from '@src/ONYXKEYS';
4444
import SCREENS from '@src/SCREENS';
45-
import type {PersonalDetailsList, Policy, Report, Transaction, TransactionViolations} from '@src/types/onyx';
45+
import type {PersonalDetailsList, Policy, Transaction, TransactionViolations} from '@src/types/onyx';
4646
import {getEmptyObject} from '@src/types/utils/EmptyObject';
4747

4848
type SearchMoneyRequestPageProps =
@@ -68,6 +68,7 @@ function SearchMoneyRequestReportPage({route}: SearchMoneyRequestPageProps) {
6868
const firstRenderRef = useRef(true);
6969

7070
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportIDFromRoute}`, {allowStaleData: true, canBeMissing: true});
71+
const prevReport = usePrevious(report);
7172

7273
const isFocused = useIsFocused();
7374

@@ -77,7 +78,7 @@ function SearchMoneyRequestReportPage({route}: SearchMoneyRequestPageProps) {
7778
return;
7879
}
7980

80-
const isRemovalExpectedForReportType = !report && isMoneyRequestReport(report);
81+
const isRemovalExpectedForReportType = !report && isMoneyRequestReport(prevReport);
8182

8283
if (isRemovalExpectedForReportType) {
8384
if (!isFocused) {

0 commit comments

Comments
 (0)