| author | |
| committer | |
| log | 447236d51f4d6835482f6707d627dbc8a39eb553 |
| tree | dbc06768f653be34829b8590f21ae70c1fe7a1ea |
| parent | 5165b8c333c0da8566a93f98011672ebd1dff9bb |
| signature | Signed by PGP key B5690EEEBB952194 |
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>5 files changed, 24 insertions(+), 22 deletions(-)
apps/web/src/components/ChatView.tsx+5-5| ... | ... | @@ -119,7 +119,10 @@ import { getProviderModelCapabilities, resolveSelectableProvider } from "../prov |
| 119 | 119 | import { useSettings } from "../hooks/useSettings"; |
| 120 | 120 | import { resolveAppModelSelectionForInstance } from "../modelSelection"; |
| 121 | 121 | import { isTerminalFocused } from "../lib/terminalFocus"; |
| 122 | import { deriveLogicalProjectKeyFromSettings } from "../logicalProject"; | |
| 122 | import { | |
| 123 | deriveLogicalProjectKeyFromSettings, | |
| 124 | selectProjectGroupingSettings, | |
| 125 | } from "../logicalProject"; | |
| 123 | 126 | import { |
| 124 | 127 | reconnectSavedEnvironment, |
| 125 | 128 | useSavedEnvironmentRegistryStore, |
| ... | ... | @@ -942,10 +945,7 @@ export default function ChatView(props: ChatViewProps) { |
| 942 | 945 | }, |
| 943 | 946 | [], |
| 944 | 947 | ); |
| 945 | const projectGroupingSettings = useSettings((settings) => ({ | |
| 946 | sidebarProjectGroupingMode: settings.sidebarProjectGroupingMode, | |
| 947 | sidebarProjectGroupingOverrides: settings.sidebarProjectGroupingOverrides, | |
| 948 | })); | |
| 948 | const projectGroupingSettings = useSettings(selectProjectGroupingSettings); | |
| 949 | 949 | const logicalProjectEnvironments = useMemo(() => { |
| 950 | 950 | if (!activeProject) return []; |
| 951 | 951 | const logicalKey = deriveLogicalProjectKeyFromSettings(activeProject, projectGroupingSettings); |
apps/web/src/components/Sidebar.tsx+3-8| ... | ... | @@ -183,6 +183,7 @@ import { |
| 183 | 183 | derivePhysicalProjectKey, |
| 184 | 184 | deriveProjectGroupingOverrideKey, |
| 185 | 185 | getProjectOrderKey, |
| 186 | selectProjectGroupingSettings, | |
| 186 | 187 | } from "../logicalProject"; |
| 187 | 188 | import { |
| 188 | 189 | useSavedEnvironmentRegistryStore, |
| ... | ... | @@ -940,10 +941,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec |
| 940 | 941 | const defaultThreadEnvMode = useSettings<ThreadEnvMode>( |
| 941 | 942 | (settings) => settings.defaultThreadEnvMode, |
| 942 | 943 | ); |
| 943 | const projectGroupingSettings = useSettings((settings) => ({ | |
| 944 | sidebarProjectGroupingMode: settings.sidebarProjectGroupingMode, | |
| 945 | sidebarProjectGroupingOverrides: settings.sidebarProjectGroupingOverrides, | |
| 946 | })); | |
| 944 | const projectGroupingSettings = useSettings(selectProjectGroupingSettings); | |
| 947 | 945 | const { updateSettings } = useUpdateSettings(); |
| 948 | 946 | const sidebarThreadPreviewCount = useSettings<SidebarThreadPreviewCount>( |
| 949 | 947 | (settings) => settings.sidebarThreadPreviewCount, |
| ... | ... | @@ -2800,10 +2798,7 @@ export default function Sidebar() { |
| 2800 | 2798 | const sidebarThreadSortOrder = useSettings((s) => s.sidebarThreadSortOrder); |
| 2801 | 2799 | const sidebarProjectSortOrder = useSettings((s) => s.sidebarProjectSortOrder); |
| 2802 | 2800 | const sidebarProjectGroupingMode = useSettings((s) => s.sidebarProjectGroupingMode); |
| 2803 | const projectGroupingSettings = useSettings((settings) => ({ | |
| 2804 | sidebarProjectGroupingMode: settings.sidebarProjectGroupingMode, | |
| 2805 | sidebarProjectGroupingOverrides: settings.sidebarProjectGroupingOverrides, | |
| 2806 | })); | |
| 2801 | const projectGroupingSettings = useSettings(selectProjectGroupingSettings); | |
| 2807 | 2802 | const sidebarThreadPreviewCount = useSettings((s) => s.sidebarThreadPreviewCount); |
| 2808 | 2803 | const { updateSettings } = useUpdateSettings(); |
| 2809 | 2804 | const { handleNewThread } = useNewThreadHandler(); |
apps/web/src/hooks/useHandleNewThread.ts+6-5| ... | ... | @@ -10,7 +10,11 @@ import { |
| 10 | 10 | } from "../composerDraftStore"; |
| 11 | 11 | import { newDraftId, newThreadId } from "../lib/utils"; |
| 12 | 12 | import { orderItemsByPreferredIds } from "../components/Sidebar.logic"; |
| 13 | import { deriveLogicalProjectKeyFromSettings, getProjectOrderKey } from "../logicalProject"; | |
| 13 | import { | |
| 14 | deriveLogicalProjectKeyFromSettings, | |
| 15 | getProjectOrderKey, | |
| 16 | selectProjectGroupingSettings, | |
| 17 | } from "../logicalProject"; | |
| 14 | 18 | import { selectProjectsAcrossEnvironments, useStore } from "../store"; |
| 15 | 19 | import { createThreadSelectorByRef } from "../storeSelectors"; |
| 16 | 20 | import { resolveThreadRouteTarget } from "../threadRoutes"; |
| ... | ... | @@ -19,10 +23,7 @@ import { useSettings } from "./useSettings"; |
| 19 | 23 | |
| 20 | 24 | function useNewThreadState() { |
| 21 | 25 | const projects = useStore(useShallow((store) => selectProjectsAcrossEnvironments(store))); |
| 22 | const projectGroupingSettings = useSettings((settings) => ({ | |
| 23 | sidebarProjectGroupingMode: settings.sidebarProjectGroupingMode, | |
| 24 | sidebarProjectGroupingOverrides: settings.sidebarProjectGroupingOverrides, | |
| 25 | })); | |
| 26 | const projectGroupingSettings = useSettings(selectProjectGroupingSettings); | |
| 26 | 27 | const router = useRouter(); |
| 27 | 28 | const getCurrentRouteTarget = useCallback(() => { |
| 28 | 29 | const currentRouteParams = router.state.matches[router.state.matches.length - 1]?.params ?? {}; |
apps/web/src/logicalProject.ts+8| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | import { scopedProjectKey, scopeProjectRef } from "@t3tools/client-runtime"; |
| 2 | 2 | import type { ScopedProjectRef, SidebarProjectGroupingMode } from "@t3tools/contracts"; |
| 3 | import type { UnifiedSettings } from "@t3tools/contracts/settings"; | |
| 3 | 4 | import { normalizeProjectPathForComparison } from "./lib/projectPaths"; |
| 4 | 5 | import type { Project } from "./types"; |
| 5 | 6 | |
| ... | ... | @@ -10,6 +11,13 @@ export interface ProjectGroupingSettings { |
| 10 | 11 | |
| 11 | 12 | export type ProjectGroupingMode = SidebarProjectGroupingMode; |
| 12 | 13 | |
| 14 | export function selectProjectGroupingSettings(settings: UnifiedSettings): ProjectGroupingSettings { | |
| 15 | return { | |
| 16 | sidebarProjectGroupingMode: settings.sidebarProjectGroupingMode, | |
| 17 | sidebarProjectGroupingOverrides: settings.sidebarProjectGroupingOverrides, | |
| 18 | }; | |
| 19 | } | |
| 20 | ||
| 13 | 21 | function uniqueNonEmptyValues(values: ReadonlyArray<string | null | undefined>): string[] { |
| 14 | 22 | const seen = new Set<string>(); |
| 15 | 23 | const unique: string[] = []; |
apps/web/src/routes/__root.tsx+2-4| ... | ... | @@ -33,6 +33,7 @@ import { useSettings } from "../hooks/useSettings"; |
| 33 | 33 | import { |
| 34 | 34 | deriveLogicalProjectKeyFromSettings, |
| 35 | 35 | derivePhysicalProjectKeyFromPath, |
| 36 | selectProjectGroupingSettings, | |
| 36 | 37 | } from "../logicalProject"; |
| 37 | 38 | import { |
| 38 | 39 | getServerConfigUpdatedNotification, |
| ... | ... | @@ -281,10 +282,7 @@ function EventRouter() { |
| 281 | 282 | const setActiveEnvironmentId = useStore((store) => store.setActiveEnvironmentId); |
| 282 | 283 | const navigate = useNavigate(); |
| 283 | 284 | const pathname = useLocation({ select: (loc) => loc.pathname }); |
| 284 | const projectGroupingSettings = useSettings((settings) => ({ | |
| 285 | sidebarProjectGroupingMode: settings.sidebarProjectGroupingMode, | |
| 286 | sidebarProjectGroupingOverrides: settings.sidebarProjectGroupingOverrides, | |
| 287 | })); | |
| 285 | const projectGroupingSettings = useSettings(selectProjectGroupingSettings); | |
| 288 | 286 | const readPathname = useEffectEvent(() => pathname); |
| 289 | 287 | const handledBootstrapThreadIdRef = useRef<string | null>(null); |
| 290 | 288 | const seenServerConfigUpdateIdRef = useRef(getServerConfigUpdatedNotification()?.id ?? 0); |