Skip to content

Commit 965f569

Browse files
committed
Call Search API call if user just finished the migration
1 parent 0717d3f commit 965f569

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/components/Search/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import EmptySearchView from '@pages/Search/EmptySearchView';
4747
import CONST from '@src/CONST';
4848
import ONYXKEYS from '@src/ONYXKEYS';
4949
import ROUTES from '@src/ROUTES';
50+
import SCREENS from '@src/SCREENS';
5051
import type {ReportAction} from '@src/types/onyx';
5152
import type SearchResults from '@src/types/onyx/SearchResults';
5253
import {isEmptyObject} from '@src/types/utils/EmptyObject';
@@ -235,7 +236,12 @@ function Search({queryJSON, searchResults, onSearchListScroll, contentContainerS
235236
}, [isSmallScreenWidth, selectedTransactions, isMobileSelectionModeEnabled]);
236237

237238
useEffect(() => {
238-
if (!isFocused || isOffline) {
239+
const activeRoute = Navigation.getActiveRoute();
240+
const screenParamMatch = activeRoute.match(/screen=([^&]+)/);
241+
const screenParam = screenParamMatch ? decodeURIComponent(screenParamMatch[1]) : null;
242+
const isMigratedModalDisplay = activeRoute.includes(ROUTES.MIGRATED_USER_WELCOME_MODAL.getRoute(true)) || screenParam === SCREENS.MIGRATED_USER_WELCOME_MODAL.ROOT;
243+
244+
if (!(isFocused || isMigratedModalDisplay) || isOffline) {
239245
return;
240246
}
241247

0 commit comments

Comments
 (0)