Skip to content

Commit 525fd5e

Browse files
committed
fix: pro build error
1 parent 25e6640 commit 525fd5e

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

apps/pro-web/components/layout/sidebar/sidebar-link.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export function SidebarLink({
5353
setSelectedChatbots,
5454
setExpandedDepartments,
5555
expandedDepartments,
56+
activeChatbot,
5657
} = useSidebar()
5758

5859
const { setActiveDepartment, activeDepartment } = useWorkspace()
@@ -96,14 +97,12 @@ export function SidebarLink({
9697
prev.includes(department.departmentId) ? [] : [department.departmentId],
9798
)
9899
setActiveChatbot(null)
99-
setActiveDepartment((prevDepartment) => {
100-
const newDepartmentId =
101-
department.departmentId === prevDepartment
102-
? null // clicking the same department turns it off
103-
: department.departmentId
100+
const newDepartment: [string, number] | null =
101+
activeDepartment && department.departmentId === activeDepartment[1]
102+
? null
103+
: ['department', department.departmentId]
104104

105-
return newDepartmentId
106-
})
105+
setActiveDepartment(newDepartment)
107106
},
108107
[
109108
router,
@@ -144,7 +143,7 @@ export function SidebarLink({
144143

145144
// TODO: Create a guard in a useEffect to fetch the current department by grabbing the department param and fetch the department to update the activeDepartment state
146145

147-
const isActive = activeDepartment === department.departmentId
146+
const isActive = activeDepartment?.[1] === department.departmentId
148147
const isDepartmentSelected = allBotsSelected
149148
const isIndeterminate = someBotsSelected && !allBotsSelected
150149
const isPro = routeType === 'pro'
@@ -193,7 +192,7 @@ export function SidebarLink({
193192
const departmentUrl = useMemo(() => {
194193
if (!department) return ''
195194

196-
const isNewDepartment = department.departmentId !== activeDepartment
195+
const isNewDepartment = activeDepartment?.[1] !== department.departmentId
197196

198197
if (page === 'profile') {
199198
// For profile pages

apps/pro-web/lib/hooks/use-workspace.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,8 @@ export function WorkspaceProvider({
647647
initialState,
648648
userDocuments,
649649
isWorkspaceStructureLoading,
650+
expandedDepartments: [], // Add default value or replace with actual state
651+
setExpandedDepartments: () => {}, // Add default function or replace with actual implementation
650652
...stableSetters,
651653
}),
652654
[

0 commit comments

Comments
 (0)