on master help sign in
Write logout stack depth as named constant
commit5a0f5bf9abf03bd82ddfd4311df077c6540edeb5 authorFang <git@fang.io> dateMon 2 Sep 2019, 19:35 (7 years ago) parentbe7b6c2
1 file changed+3−1
src/components/View.js+3−1
src/components/View.js+3−1
@@ -7,6 +7,8 @@ import useBreakpoints from 'lib/useBreakpoints';
77import MiniBackButton from './MiniBackButton';
88import { useHistory } from 'store/history';
99
10+const EXPECT_LOGOUT_WHEN_POPPING_AT_DEPTH = 2;
11+
1012// View is a top-level component that all Views must render to inherit styling
1113function View({
1214 className,
@@ -28,7 +30,7 @@ function View({
2830 const goBack = useCallback(() => pop(), [pop]);
2931
3032 const showBackButton = size > 1 && !!pop;
31− const backIsLogout = size === 2;
33+ const backIsLogout = size === EXPECT_LOGOUT_WHEN_POPPING_AT_DEPTH;
3234
3335 return (
3436 <Flex