Skip to content

Instantly share code, notes, and snippets.

@Sekhmet
Created February 7, 2018 12:02
Show Gist options
  • Save Sekhmet/2f27c22d9e3ea0877addfb2d0ebe829f to your computer and use it in GitHub Desktop.
Save Sekhmet/2f27c22d9e3ea0877addfb2d0ebe829f to your computer and use it in GitHub Desktop.
diff --git a/src/client/feed/LetsGetStarted.js b/src/client/feed/LetsGetStarted.js
index 58b87906..016c9597 100644
--- a/src/client/feed/LetsGetStarted.js
+++ b/src/client/feed/LetsGetStarted.js
@@ -15,7 +15,7 @@ import {
} from '../reducers';
import HorizontalBarChart from '../components/HorizontalBarChart';
import LetsGetStartedIcon from './LetsGetStartedIcon';
-import DelayComponent from '../components/DelayComponent';
+// import DelayComponent from '../components/DelayComponent';
import './LetsGetStarted.less';
@connect(state => ({
@@ -25,6 +25,7 @@ import './LetsGetStarted.less';
isFetchingFollowingList: getIsFetchingFollowingList(state),
loaded: getIsLoaded(state),
authenticated: getIsAuthenticated(state),
+ followingFetched: state.user.following.fetched,
}))
class LetsGetStarted extends React.Component {
static propTypes = {
@@ -82,7 +83,13 @@ class LetsGetStarted extends React.Component {
}
render() {
- const { authenticated, isFetchingFollowingList, isAuthFetching, loaded } = this.props;
+ const {
+ authenticated,
+ isFetchingFollowingList,
+ isAuthFetching,
+ loaded,
+ followingFetched,
+ } = this.props;
const { hasProfile, hasPost, hasVoted, hasFollowed } = this.state;
const totalOptions = 4;
const currentSelected = _.reduce(
@@ -96,10 +103,12 @@ class LetsGetStarted extends React.Component {
},
0,
);
- const hideSidebarContent =
- currentSelected === totalOptions || !authenticated || isFetchingFollowingList || !loaded;
- if (hideSidebarContent) return <div />;
+ const ready = followingFetched && loaded;
+
+ const hide = !authenticated || currentSelected === totalOptions;
+
+ if (!ready || hide) return <div />;
return (
<div className="LetsGetStarted">
@@ -191,4 +200,5 @@ class LetsGetStarted extends React.Component {
}
}
-export default DelayComponent({ delay: 500 })(LetsGetStarted);
+// export default DelayComponent({ delay: 500 })(LetsGetStarted);
+export default LetsGetStarted;
diff --git a/src/client/user/userReducer.js b/src/client/user/userReducer.js
index 7f9284ad..0cc4a23a 100644
--- a/src/client/user/userReducer.js
+++ b/src/client/user/userReducer.js
@@ -30,6 +30,7 @@ export default function userReducer(state = initialState, action) {
...state.following,
list: [],
isFetching: true,
+ fetched: false,
},
};
case actions.GET_FOLLOWING_ERROR:
@@ -39,6 +40,7 @@ export default function userReducer(state = initialState, action) {
...state.following,
list: [],
isFetching: false,
+ fetched: true,
},
};
case actions.GET_FOLLOWING_SUCCESS:
@@ -49,6 +51,7 @@ export default function userReducer(state = initialState, action) {
...state.following,
list: action.payload,
isFetching: false,
+ fetched: true,
},
};
case actions.FOLLOW_USER_START:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment