Skip to content

Commit 5a78778

Browse files
committed
navReducer [nfc]: Remove an initial: true params hack.
In the previous commit, we removed our last call site of `getStateWithRoute` where 'realm' was passed for `route`. Therefore, this conditional can disappear. See more about this hack at zulip#4273 (comment).
1 parent 4427d38 commit 5a78778

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

src/nav/navReducer.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,7 @@ import { INITIAL_FETCH_COMPLETE, ACCOUNT_SWITCH, LOGIN_SUCCESS, LOGOUT } from '.
1111
* Private; exported only for tests.
1212
*/
1313
export const getStateForRoute = (route: string): NavigationState => {
14-
// TODO: this is kind of a hack! Refactor to a better way.
15-
// * Perhaps pass `initial: true` unconditionally in this initialization
16-
// code, to all routes? Then that'd just be part of the interface of
17-
// making a screen work as an initial screen.
18-
// * Alternatively, we could replace the whole system of `ModalNavBar`,
19-
// `canGoBack`, etc., with our own "navigation view" that would be more
20-
// directly integrated into the navigation framework:
21-
// https://reactnavigation.org/docs/en/2.x/navigation-views.html
22-
const params = route === 'realm' ? { initial: true } : undefined;
23-
24-
const action = AppNavigator.router.getActionForPathAndParams(route, params);
14+
const action = AppNavigator.router.getActionForPathAndParams(route);
2515
if (!action) {
2616
// The argument should be a constant string that is a genuine nav route;
2717
// so this condition can only happen if we've gotten that wrong.

src/start/RealmScreen.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ type Props = $ReadOnly<{|
2424
...NavigationStateRoute,
2525
params?: {|
2626
realm: URL | void,
27-
// Currently passed as `true` in a hack in `navReducer.js`; see
28-
// https://github.com/zulip/zulip-mobile/pull/4273#discussion_r499114689.
29-
// TODO: Stop using that hack.
3027
initial?: boolean,
3128
|},
3229
|}>,

0 commit comments

Comments
 (0)