diff --git a/frontend/src/components/sidebar/nav-agents.tsx b/frontend/src/components/sidebar/nav-agents.tsx index 727e6157..290a189e 100644 --- a/frontend/src/components/sidebar/nav-agents.tsx +++ b/frontend/src/components/sidebar/nav-agents.tsx @@ -72,6 +72,12 @@ export function NavAgents() { const projects = await getProjects() as Project[] console.log("Projects loaded:", projects.length, projects.map(p => ({ id: p.id, name: p.name }))); + // If no projects are found, the user might not be logged in + if (projects.length === 0) { + setThreads([]) + return + } + // Create a map of projects by ID for faster lookups const projectsById = new Map(); projects.forEach(project => { @@ -113,6 +119,8 @@ export function NavAgents() { setThreads(sortThreads(threadsWithProjects)) } catch (err) { console.error("Error loading threads with projects:", err) + // Set empty threads array on error + setThreads([]) } finally { if (showLoading) { setIsLoading(false) diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts index be726810..e9ef2713 100644 --- a/frontend/src/lib/api.ts +++ b/frontend/src/lib/api.ts @@ -294,8 +294,25 @@ export const deleteProject = async (projectId: string): Promise => { // Thread APIs export const getThreads = async (projectId?: string): Promise => { const supabase = createClient(); + + // Get the current user's ID to filter threads + const { data: userData, error: userError } = await supabase.auth.getUser(); + if (userError) { + console.error('Error getting current user:', userError); + return []; + } + + // If no user is logged in, return an empty array + if (!userData.user) { + console.log('[API] No user logged in, returning empty threads array'); + return []; + } + let query = supabase.from('threads').select('*'); + // Always filter by the current user's account ID + query = query.eq('account_id', userData.user.id); + if (projectId) { console.log('[API] Filtering threads by project_id:', projectId); query = query.eq('project_id', projectId); diff --git a/frontend/src/lib/home.tsx b/frontend/src/lib/home.tsx index 9ef73a17..fcc2c81f 100644 --- a/frontend/src/lib/home.tsx +++ b/frontend/src/lib/home.tsx @@ -83,9 +83,9 @@ export const siteConfig = { buttonText: "Hire Suna", buttonColor: "bg-secondary text-white", isPopular: false, - hours: "no free usage at this time", + hours: "10 min", features: [ - "no free usage", + "10 minutes", // "Community support", // "Single user", // "Standard response time",