Merge pull request #4230 from overleaf/msm-prevent-chat-render

Prevent chat-pane from being rendered when user is not defined

GitOrigin-RevId: d044c5d9dc7f07fa535bed746b46a6cff1f78dff
This commit is contained in:
Timothée Alby 2021-06-21 16:02:20 +02:00 committed by Copybot
parent 1c24ecd33e
commit 834c7181e5

View file

@ -18,7 +18,7 @@ const ChatPane = React.memo(function ChatPane() {
const { chatIsOpen } = useLayoutContext({ chatIsOpen: PropTypes.bool }) const { chatIsOpen } = useLayoutContext({ chatIsOpen: PropTypes.bool })
const { user } = useApplicationContext({ const { user } = useApplicationContext({
user: PropTypes.shape({ id: PropTypes.string.isRequired }.isRequired), user: PropTypes.shape({ id: PropTypes.string.isRequired }),
}) })
const { const {
@ -55,6 +55,10 @@ const ChatPane = React.memo(function ChatPane() {
throw error throw error
} }
if (!user) {
return null
}
return ( return (
<aside className="chat"> <aside className="chat">
<InfiniteScroll <InfiniteScroll