diff --git a/services/web/frontend/js/features/chat/components/chat-pane.js b/services/web/frontend/js/features/chat/components/chat-pane.js index 8daff84f2e..ba40859124 100644 --- a/services/web/frontend/js/features/chat/components/chat-pane.js +++ b/services/web/frontend/js/features/chat/components/chat-pane.js @@ -15,7 +15,9 @@ function ChatPane() { const { t } = useTranslation() const { chatIsOpen } = useLayoutContext({ chatIsOpen: PropTypes.bool }) - const { user } = useApplicationContext() + const { user } = useApplicationContext({ + user: PropTypes.shape({ id: PropTypes.string.isRequired }.isRequired), + }) const { status, diff --git a/services/web/frontend/js/shared/context/application-context.js b/services/web/frontend/js/shared/context/application-context.js index f7b8b14c9a..ca82192dbc 100644 --- a/services/web/frontend/js/shared/context/application-context.js +++ b/services/web/frontend/js/shared/context/application-context.js @@ -16,9 +16,13 @@ ApplicationContext.Provider.propTypes = { export function ApplicationProvider({ children }) { const applicationContextValue = { - user: window.user, gitBridgePublicBaseUrl: window.gitBridgePublicBaseUrl, } + + if (window.user.id) { + applicationContextValue.user = window.user + } + return ( {children} diff --git a/services/web/frontend/js/shared/context/root-context.js b/services/web/frontend/js/shared/context/root-context.js index de8e0ace26..c8675f85e8 100644 --- a/services/web/frontend/js/shared/context/root-context.js +++ b/services/web/frontend/js/shared/context/root-context.js @@ -8,12 +8,18 @@ import { LayoutProvider } from './layout-context' import { CompileProvider } from './compile-context' export function ContextRoot({ children, ide, settings }) { + const isAnonymousUser = window.user.id == null + return ( - {children} + {isAnonymousUser ? ( + children + ) : ( + {children} + )}