Skip to content

Commit

Permalink
fix switching ws still shows other ws chat
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardoj committed Jul 2, 2024
1 parent eb8b251 commit a05744b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/libs/Navigation/AppNavigator/AuthScreens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import type {OnyxEntry} from 'react-native-onyx';
import Onyx, {withOnyx} from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
import OptionsListContextProvider from '@components/OptionListContextProvider';
import useLastAccessedReportID from '@hooks/useLastAccessedReportID';
import useOnboardingLayout from '@hooks/useOnboardingLayout';
import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';
Expand Down Expand Up @@ -83,15 +82,14 @@ function shouldOpenOnAdminRoom() {
return url ? new URL(url).searchParams.get('openOnAdminRoom') === 'true' : false;
}

function getCentralPaneScreenInitialParams(screenName: CentralPaneName, lastAccessedReportID?: string): Partial<ValueOf<CentralPaneScreensParamList>> {
function getCentralPaneScreenInitialParams(screenName: CentralPaneName): Partial<ValueOf<CentralPaneScreensParamList>> {
if (screenName === SCREENS.SEARCH.CENTRAL_PANE) {
return {sortBy: CONST.SEARCH.TABLE_COLUMNS.DATE, sortOrder: CONST.SEARCH.SORT_ORDER.DESC};
}

if (screenName === SCREENS.REPORT) {
return {
openOnAdminRoom: shouldOpenOnAdminRoom() ? true : undefined,
reportID: lastAccessedReportID,
};
}

Expand Down Expand Up @@ -198,7 +196,6 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie
const StyleUtils = useStyleUtils();
const {isSmallScreenWidth} = useWindowDimensions();
const {shouldUseNarrowLayout} = useOnboardingLayout();
const lastAccessedReportID = useLastAccessedReportID(shouldOpenOnAdminRoom());
const screenOptions = getRootNavigatorScreenOptions(isSmallScreenWidth, styles, StyleUtils);
const onboardingModalScreenOptions = useMemo(() => screenOptions.onboardingModalNavigator(shouldUseNarrowLayout), [screenOptions, shouldUseNarrowLayout]);
const onboardingScreenOptions = useMemo(
Expand Down Expand Up @@ -474,7 +471,7 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie
<RootStack.Screen
key={centralPaneName}
name={centralPaneName}
initialParams={getCentralPaneScreenInitialParams(centralPaneName, lastAccessedReportID)}
initialParams={getCentralPaneScreenInitialParams(centralPaneName)}
getComponent={componentGetter}
options={CentralPaneScreenOptions}
/>
Expand Down

0 comments on commit a05744b

Please sign in to comment.