Skip to content
5 changes: 1 addition & 4 deletions src/libs/Navigation/NavigationRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,7 @@ function NavigationRoot({authenticated, lastVisitedPath, initialUrl, onReady}: N
const currentRoute = navigationRef.getCurrentRoute();
Firebase.log(`[NAVIGATION] screen: ${currentRoute?.name}, params: ${JSON.stringify(currentRoute?.params ?? {})}`);

// Performance optimization to avoid context consumers to delay first render
setTimeout(() => {
currentReportIDValue?.updateCurrentReportID(state);
}, 0);
currentReportIDValue?.updateCurrentReportID(state);
parseAndLogRoute(state);

// We want to clean saved scroll offsets for screens that aren't anymore in the state.
Expand Down
6 changes: 5 additions & 1 deletion src/pages/NewReportWorkspaceSelectionPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import type {OnyxCollection} from 'react-native-onyx';
import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import * as Expensicons from '@components/Icon/Expensicons';

Check warning on line 6 in src/pages/NewReportWorkspaceSelectionPage.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'@components/Icon/Expensicons' import is restricted from being used by a pattern. Direct imports from Icon/Expensicons are deprecated. Please use lazy loading hooks instead. Use `useMemoizedLazyExpensifyIcons` from @hooks/useLazyAsset. See docs/LAZY_ICONS_AND_ILLUSTRATIONS.md for details

Check warning on line 6 in src/pages/NewReportWorkspaceSelectionPage.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'@components/Icon/Expensicons' import is restricted from being used. Direct imports from @components/Icon/Expensicons are deprecated. Please use lazy loading hooks instead. Use `useMemoizedLazyExpensifyIcons` from @hooks/useLazyAsset. See docs/LAZY_ICONS_AND_ILLUSTRATIONS.md for details
import ScreenWrapper from '@components/ScreenWrapper';
import {useSearchContext} from '@components/Search/SearchContext';
import SelectionList from '@components/SelectionList';
Expand All @@ -20,6 +20,7 @@
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useThemeStyles from '@hooks/useThemeStyles';
import {createNewReport} from '@libs/actions/Report';
import isSearchTopmostFullScreenRoute from '@libs/Navigation/helpers/isSearchTopmostFullScreenRoute';
import setNavigationActionToMicrotaskQueue from '@libs/Navigation/helpers/setNavigationActionToMicrotaskQueue';
import Navigation from '@libs/Navigation/Navigation';
import type {NewReportWorkspaceSelectionNavigatorParamList} from '@libs/Navigation/types';
Expand Down Expand Up @@ -103,7 +104,10 @@
}

Navigation.setNavigationActionToMicrotaskQueue(() => {
Navigation.navigate(ROUTES.SEARCH_MONEY_REQUEST_REPORT.getRoute({reportID: optimisticReportID}), {forceReplace: isRHPOnReportInSearch || shouldUseNarrowLayout});
Navigation.navigate(
isSearchTopmostFullScreenRoute() ? ROUTES.SEARCH_MONEY_REQUEST_REPORT.getRoute({reportID: optimisticReportID}) : ROUTES.REPORT_WITH_ID.getRoute(optimisticReportID),
{forceReplace: isRHPOnReportInSearch || shouldUseNarrowLayout},
);
});
},
[isRHPOnReportInSearch, shouldUseNarrowLayout],
Expand Down Expand Up @@ -146,7 +150,7 @@
}
navigateToNewReport(optimisticReport.reportID);
},
[

Check warning on line 153 in src/pages/NewReportWorkspaceSelectionPage.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

React Hook useCallback has a missing dependency: 'selfDMReportID'. Either include it or remove the dependency array
activePolicyID,
currentUserPersonalDetails,
isASAPSubmitBetaEnabled,
Expand Down Expand Up @@ -267,7 +271,7 @@
shouldSyncFocus: true,
}))
.sort((a, b) => localeCompare(a.text, b.text));
}, [policies, isOffline, currentUserPersonalDetails?.login, localeCompare, hasPerDiemTransactions]);

Check warning on line 274 in src/pages/NewReportWorkspaceSelectionPage.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

React Hook useMemo has an unnecessary dependency: 'isOffline'. Either exclude it or remove the dependency array

const filteredAndSortedUserWorkspaces = useMemo<WorkspaceListItem[]>(
() => usersWorkspaces.filter((policy) => policy.text?.toLowerCase().includes(debouncedSearchTerm?.toLowerCase() ?? '')),
Expand Down
Loading