From a68fee17f71b55d1fc2900f626135bfc225666ae Mon Sep 17 00:00:00 2001 From: tima101 Date: Mon, 15 Apr 2019 20:20:33 -0700 Subject: [PATCH] checked for existence of currentUser: fix for #21 --- app/components/discussions/DiscussionListItem.tsx | 2 +- app/components/layout/index.tsx | 2 +- app/components/posts/PostEditor.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/components/discussions/DiscussionListItem.tsx b/app/components/discussions/DiscussionListItem.tsx index 51112cff..67f69a01 100644 --- a/app/components/discussions/DiscussionListItem.tsx +++ b/app/components/discussions/DiscussionListItem.tsx @@ -21,7 +21,7 @@ class DiscussionListItem extends React.Component { 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' diff --git a/app/components/layout/index.tsx b/app/components/layout/index.tsx index 485575dc..07136642 100644 --- a/app/components/layout/index.tsx +++ b/app/components/layout/index.tsx @@ -92,7 +92,7 @@ class Layout extends React.Component { 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 ( diff --git a/app/components/posts/PostEditor.tsx b/app/components/posts/PostEditor.tsx index 3e9b18e2..55582299 100644 --- a/app/components/posts/PostEditor.tsx +++ b/app/components/posts/PostEditor.tsx @@ -71,7 +71,7 @@ class PostEditor extends React.Component { 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 (