Skip to content

Commit

Permalink
Adds check to workspace data props access
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecmart committed Jul 12, 2024
1 parent 1dbb6bb commit c7065e9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/protolib/src/components/AdminPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { forwardRef, useState } from 'react';
import { AppState } from './AdminPanel'
import { useAtom } from 'jotai';
import { SiteConfig } from 'app/conf'
import workspaces from 'app/bundles/workspaces'
import Workspaces from 'app/bundles/workspaces'

const Chat = dynamic(() => import('./Chat'), { ssr: false })

Expand All @@ -24,9 +24,9 @@ export const AdminPage = forwardRef(({ pageSession, title, children, integratedC
const userSpaces = useWorkspaces()

const currentWorkspace = settings && settings.workspace ? settings.workspace : userSpaces[0]
const workspace = typeof workspaces[currentWorkspace] === 'function' ? workspaces[currentWorkspace]({ pages: [] }) : workspaces[currentWorkspace]
const workspaceData = typeof Workspaces[currentWorkspace] === 'function' ? Workspaces[currentWorkspace]({ pages: [] }) : Workspaces[currentWorkspace]

const settingsAssistant = workspace.assistant
const settingsAssistant = workspaceData?.assistant
const settingsAssistantEnabled = settingsAssistant === undefined ? true : settingsAssistant

usePrompt(() => `The user is browsing an admin page in the admin panel. The title of the admin page is: "${title}"`)
Expand Down
2 changes: 1 addition & 1 deletion packages/protolib/src/components/AdminPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const AdminPanel = ({ children }) => {


const workspaceData = typeof Workspaces[currentWorkspace] === 'function' ? Workspaces[currentWorkspace]({ pages: pages ?? [] }) : Workspaces[currentWorkspace]
const settingsLogs = workspaceData.logs
const settingsLogs = workspaceData?.logs
const settingsLogsEnabled = settingsLogs === undefined ? true : settingsLogs

// console.log('userSpaces: ', userSpaces, 'current Workspace: ', currentWorkspace)
Expand Down

0 comments on commit c7065e9

Please sign in to comment.