Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix - display the home route when the app restarts on mobile platforms #36637

Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/setup/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {I18nManager} from 'react-native';
import Onyx from 'react-native-onyx';
import getPlatform from '@libs/getPlatform';
import intlPolyfill from '@libs/IntlPolyfill';
import * as Metrics from '@libs/Metrics';
import * as Device from '@userActions/Device';
Expand All @@ -8,6 +9,13 @@ import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import platformSetup from './platformSetup';

function initializeLastVisitedPath(): string | undefined {
if (!(getPlatform() === CONST.PLATFORM.ANDROID || getPlatform() === CONST.PLATFORM.IOS)) {
Copy link
Member

@rushatgabhane rushatgabhane Feb 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HezekielT please use platform specific files for this function.
Nothing wrong with inline platform checks, but we want to be consistent with the codestyle

return;
}
return '';
}

export default function () {
/*
* Initialize the Onyx store when the app loads for the first time.
Expand Down Expand Up @@ -40,6 +48,8 @@ export default function () {
isVisible: false,
willAlertModalBecomeVisible: false,
},
// Always open the home route on app startup for native platforms by clearing the lastVisitedPath
[ONYXKEYS.LAST_VISITED_PATH]: initializeLastVisitedPath(),
},
});

Expand Down
Loading