Skip to content

Commit

Permalink
checked for existence of currentUser: fix for async-labs#21
Browse files Browse the repository at this point in the history
  • Loading branch information
tima101 committed Apr 16, 2019
1 parent 9337b56 commit a68fee1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/components/discussions/DiscussionListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DiscussionListItem extends React.Component<Props> {
const selectedDiscussion =
store.currentUrl === `/team/${team.slug}/discussions/${discussion.slug}`;

const isThemeDark = store.currentUser.darkTheme === true;
const isThemeDark = store && store.currentUser && store.currentUser.darkTheme === true;

const selectedItemBorder = isThemeDark
? '1px rgba(255, 255, 255, 0.75) solid'
Expand Down
2 changes: 1 addition & 1 deletion app/components/layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class Layout extends React.Component<MyProps> {
const { store, firstGridItem, children, teamRequired, isMobile } = this.props;
const { currentTeam, currentUser } = store;

const isThemeDark = currentUser.darkTheme === true;
const isThemeDark = currentUser && currentUser.darkTheme === true;

if (store.isLoggingIn) {
return (
Expand Down
2 changes: 1 addition & 1 deletion app/components/posts/PostEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class PostEditor extends React.Component<MyProps, MyState> {

const membersMinusCurrentUser = members.filter(member => member._id !== currentUser._id);

const isThemeDark = store.currentUser.darkTheme === true;
const isThemeDark = store && store.currentUser && store.currentUser.darkTheme === true;
const textareaBackgroundColor = isThemeDark ? '#303030' : '#fff';

return (
Expand Down

0 comments on commit a68fee1

Please sign in to comment.