diff --git a/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx b/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx index e6a33002a0..0a14b7847c 100644 --- a/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx +++ b/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx @@ -257,10 +257,6 @@ function ThreadNavigationSidebarPane( setSelectedProjectKey(null); } }, [projectFilterOptions, selectedProjectKey]); - const scopedProjects = useMemo( - () => (selectedProjectScope === null ? projects : selectedProjectScope.projects), - [projects, selectedProjectScope], - ); const selectedProjectRefs = useMemo( () => selectedProjectScope === null @@ -272,6 +268,15 @@ function ThreadNavigationSidebarPane( ), [selectedProjectScope], ); + const scopedProjects = useMemo( + () => + selectedProjectRefs === null + ? projects + : projects.filter((project) => + selectedProjectRefs.has(scopedProjectKey(project.environmentId, project.id)), + ), + [projects, selectedProjectRefs], + ); const scopedThreads = useMemo( () => selectedProjectRefs === null