File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 1- import { useTasks } from "@features/tasks/hooks/useTasks " ;
1+ import { useWorkspaceStore } from "@features/workspace/stores/workspaceStore " ;
22import { Box } from "@radix-ui/themes" ;
33import { useEffect } from "react" ;
44import { useSidebarStore } from "../stores/sidebarStore" ;
55import { Sidebar , SidebarContent } from "./index" ;
66
77export function MainSidebar ( ) {
8- const { data : tasks = [ ] , isFetched } = useTasks ( ) ;
8+ const workspaces = useWorkspaceStore ( ( state ) => state . workspaces ) ;
9+ const isLoaded = useWorkspaceStore ( ( state ) => state . isLoaded ) ;
910 const setOpenAuto = useSidebarStore ( ( state ) => state . setOpenAuto ) ;
1011
1112 useEffect ( ( ) => {
12- if ( isFetched ) {
13- setOpenAuto ( tasks . length > 0 ) ;
13+ if ( isLoaded ) {
14+ const workspaceCount = Object . keys ( workspaces ) . length ;
15+ setOpenAuto ( workspaceCount > 0 ) ;
1416 }
15- } , [ isFetched , tasks . length , setOpenAuto ] ) ;
17+ } , [ isLoaded , workspaces , setOpenAuto ] ) ;
1618
1719 return (
1820 < Box flexShrink = "0" style = { { flexShrink : 0 } } >
You can’t perform that action at this time.
0 commit comments