@@ -128,21 +128,21 @@ import { isMacPlatform } from "~/lib/utils";
128128import { useOpenPrLink } from "../lib/openPullRequestLink" ;
129129import { readLocalApi } from "../localApi" ;
130130import { useSidebarPendingFileDropStore } from "../sidebarPendingFileDropStore" ;
131- import { getProjectOrderKey , selectProjectGroupingSettings } from "../logicalProject" ;
131+ import { selectProjectGroupingSettings } from "../logicalProject" ;
132132import {
133- buildSidebarProjectSnapshots ,
134133 projectGroupsSpanEnvironments ,
135134 resolveSidebarProjectScopeKey ,
136135 getSidebarProjectSettingsKey ,
137136 type SidebarProjectSnapshot ,
138137} from "../sidebarProjectGrouping" ;
139- import { legacyProjectCwdPreferenceKey , useUiStateStore } from "../uiStateStore" ;
138+ import { useUiStateStore } from "../uiStateStore" ;
140139import {
141140 getThreadKeysToDeselectAfterDelete ,
142141 useThreadSelectionStore ,
143142} from "../threadSelectionStore" ;
144143import { useAcknowledgeThreadWoke , useThreadActions } from "../hooks/useThreadActions" ;
145144import { useHandleNewThread } from "../hooks/useHandleNewThread" ;
145+ import { useSidebarProjectGroups } from "../hooks/useSidebarProjectGroups" ;
146146import { useTerminalFocus } from "../hooks/useTerminalFocus" ;
147147import { isCommandPaletteOpen , openCommandPalette } from "../commandPaletteBus" ;
148148import { registerSettleAndAdvance } from "../settleAndAdvance" ;
@@ -224,7 +224,6 @@ import {
224224 sidebarThreadKeyAtY ,
225225 sortInboxThreadsByReturn ,
226226 sortPinnedThreadsForSidebar ,
227- sortSidebarV2ProjectGroups ,
228227 sortThreadsForSidebar ,
229228 sortWorkingThreadsBySend ,
230229 useThreadJumpHintVisibility ,
@@ -2420,14 +2419,12 @@ const SidebarSearchResultRow = memo(function SidebarSearchResultRow(props: {
24202419
24212420export default function Sidebar ( ) {
24222421 const projects = useProjects ( ) ;
2423- const projectOrder = useUiStateStore ( ( store ) => store . projectOrder ) ;
24242422 const threads = useThreadShells ( ) ;
24252423 const router = useRouter ( ) ;
24262424 const { isMobile, setOpenMobile } = useSidebar ( ) ;
24272425 const keybindings = useAtomValue ( primaryServerKeybindingsAtom ) ;
24282426 const confirmThreadDelete = useClientSettings ( ( s ) => s . confirmThreadDelete ) ;
24292427 const confirmThreadArchive = useClientSettings ( ( s ) => s . confirmThreadArchive ) ;
2430- const sidebarProjectSortOrder = useClientSettings ( ( s ) => s . sidebarProjectSortOrder ) ;
24312428 const timestampFormat = useClientSettings ( ( s ) => s . timestampFormat ) ;
24322429 const workingShelfEnabled = useClientSettings ( ( s ) => s . sidebarWorkingShelfEnabled ) ;
24332430 const projectGroupingSettings = useClientSettings ( selectProjectGroupingSettings ) ;
@@ -2545,41 +2542,7 @@ export default function Sidebar() {
25452542 [ environments ] ,
25462543 ) ;
25472544 const environmentMachineById = useEnvironmentMachines ( ) ;
2548- const orderedProjects = useMemo (
2549- ( ) =>
2550- orderItemsByPreferredIds ( {
2551- items : projects ,
2552- preferredIds : projectOrder ,
2553- getId : getProjectOrderKey ,
2554- getPreferenceIds : ( project ) => [
2555- getProjectOrderKey ( project ) ,
2556- legacyProjectCwdPreferenceKey ( project . workspaceRoot ) ,
2557- ] ,
2558- } ) ,
2559- [ projectOrder , projects ] ,
2560- ) ;
2561- const unsortedProjectGroups = useMemo (
2562- ( ) =>
2563- buildSidebarProjectSnapshots ( {
2564- projects : sidebarProjectSortOrder === "manual" ? orderedProjects : projects ,
2565- groupScratchProjects : true ,
2566- settings : projectGroupingSettings ,
2567- primaryEnvironmentId,
2568- resolveEnvironmentLabel : ( environmentId ) => environmentLabelById . get ( environmentId ) ?? null ,
2569- } ) ,
2570- [
2571- environmentLabelById ,
2572- orderedProjects ,
2573- primaryEnvironmentId ,
2574- projectGroupingSettings ,
2575- projects ,
2576- sidebarProjectSortOrder ,
2577- ] ,
2578- ) ;
2579- const projectGroups = useMemo (
2580- ( ) => sortSidebarV2ProjectGroups ( unsortedProjectGroups , threads , sidebarProjectSortOrder ) ,
2581- [ sidebarProjectSortOrder , threads , unsortedProjectGroups ] ,
2582- ) ;
2545+ const projectGroups = useSidebarProjectGroups ( ) ;
25832546 const projectGroupsRef = useRef ( projectGroups ) ;
25842547 projectGroupsRef . current = projectGroups ;
25852548 // Threads on non-primary environments (T3 Connect, hosted) resolve their
0 commit comments