| author | |
| committer | |
| log | e7743632ecc89ddec30dc01d9553353a1f062c83 |
| tree | db227bdec60b81c09d8a863448aabe39c7dd330d |
| parent | f20bbdf26767db0fb286a3d66d719c0d365a9238 |
5 files changed, 14 insertions(+), 29 deletions(-)
apps/web/src/components/BranchToolbar.tsx+3-12| ... | @@ -2,7 +2,7 @@ import type { GitBranch, ThreadId } from "@t3tools/contracts"; | ... | @@ -2,7 +2,7 @@ import type { GitBranch, ThreadId } from "@t3tools/contracts"; |
| 2 | import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; | 2 | import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; |
| 3 | import { useEffect, useState } from "react"; | 3 | import { useEffect, useState } from "react"; |
| 4 | 4 | ||
| 5 | import { newCommandId } from "../lib/orchestrationIds"; | 5 | import { newCommandId } from "../lib/utils"; |
| 6 | import { | 6 | import { |
| 7 | gitBranchesQueryOptions, | 7 | gitBranchesQueryOptions, |
| 8 | gitCheckoutMutationOptions, | 8 | gitCheckoutMutationOptions, |
| ... | @@ -70,9 +70,7 @@ export default function BranchToolbar({ | ... | @@ -70,9 +70,7 @@ export default function BranchToolbar({ |
| 70 | : branchNames; | 70 | : branchNames; |
| 71 | // ── Mutations ───────────────────────────────────────────────────────── | 71 | // ── Mutations ───────────────────────────────────────────────────────── |
| 72 | 72 | ||
| 73 | const checkoutMutation = useMutation( | 73 | const checkoutMutation = useMutation(gitCheckoutMutationOptions({ cwd: branchCwd, queryClient })); |
| 74 | gitCheckoutMutationOptions({ cwd: branchCwd, queryClient }), | ||
| 75 | ); | ||
| 76 | 74 | ||
| 77 | const createBranchMutation = useMutation( | 75 | const createBranchMutation = useMutation( |
| 78 | gitCreateBranchAndCheckoutMutationOptions({ cwd: branchCwd, queryClient }), | 76 | gitCreateBranchAndCheckoutMutationOptions({ cwd: branchCwd, queryClient }), |
| ... | @@ -108,14 +106,7 @@ export default function BranchToolbar({ | ... | @@ -108,14 +106,7 @@ export default function BranchToolbar({ |
| 108 | branch: syncedBranch, | 106 | branch: syncedBranch, |
| 109 | worktreePath: null, | 107 | worktreePath: null, |
| 110 | }); | 108 | }); |
| 111 | }, [ | 109 | }, [activeThreadId, activeWorktreePath, activeThreadBranch, queryBranches, envMode, dispatch]); |
| 112 | activeThreadId, | ||
| 113 | activeWorktreePath, | ||
| 114 | activeThreadBranch, | ||
| 115 | queryBranches, | ||
| 116 | envMode, | ||
| 117 | dispatch, | ||
| 118 | ]); | ||
| 119 | 110 | ||
| 120 | useEffect(() => { | 111 | useEffect(() => { |
| 121 | if (isBranchMenuOpen) return; | 112 | if (isBranchMenuOpen) return; |
apps/web/src/components/ChatView.tsx+1-1| ... | @@ -103,7 +103,7 @@ import { | ... | @@ -103,7 +103,7 @@ import { |
| 103 | } from "~/projectScripts"; | 103 | } from "~/projectScripts"; |
| 104 | import { Toggle } from "./ui/toggle"; | 104 | import { Toggle } from "./ui/toggle"; |
| 105 | import { SidebarTrigger } from "./ui/sidebar"; | 105 | import { SidebarTrigger } from "./ui/sidebar"; |
| 106 | import { newCommandId, newMessageId } from "~/lib/orchestrationIds"; | 106 | import { newCommandId, newMessageId } from "~/lib/utils"; |
| 107 | import { readNativeApi } from "~/nativeApi"; | 107 | import { readNativeApi } from "~/nativeApi"; |
| 108 | 108 | ||
| 109 | function formatMessageMeta(createdAt: string, duration: string | null): string { | 109 | function formatMessageMeta(createdAt: string, duration: string | null): string { |
apps/web/src/components/Sidebar.tsx+1-1| ... | @@ -11,7 +11,7 @@ import { useNavigate, useParams } from "@tanstack/react-router"; | ... | @@ -11,7 +11,7 @@ import { useNavigate, useParams } from "@tanstack/react-router"; |
| 11 | import { useAppSettings } from "../appSettings"; | 11 | import { useAppSettings } from "../appSettings"; |
| 12 | import { isElectron } from "../env"; | 12 | import { isElectron } from "../env"; |
| 13 | import { APP_STAGE_LABEL } from "../branding"; | 13 | import { APP_STAGE_LABEL } from "../branding"; |
| 14 | import { newCommandId, newProjectId, newThreadId } from "../lib/orchestrationIds"; | 14 | import { newCommandId, newProjectId, newThreadId } from "../lib/utils"; |
| 15 | import { useStore } from "../store"; | 15 | import { useStore } from "../store"; |
| 16 | import { isChatNewLocalShortcut, isChatNewShortcut } from "../keybindings"; | 16 | import { isChatNewLocalShortcut, isChatNewShortcut } from "../keybindings"; |
| 17 | import { type Thread } from "../types"; | 17 | import { type Thread } from "../types"; |
apps/web/src/lib/orchestrationIds.ts deleted-15| ... | @@ -1,15 +0,0 @@ | ||
| 1 | import { ApprovalRequestId, CommandId, MessageId, ProjectId, ThreadId } from "@t3tools/contracts"; | ||
| 2 | |||
| 3 | export const newCommandId = (): CommandId => CommandId.makeUnsafe(crypto.randomUUID()); | ||
| 4 | |||
| 5 | export const newProjectId = (): ProjectId => ProjectId.makeUnsafe(crypto.randomUUID()); | ||
| 6 | |||
| 7 | export const newThreadId = (): ThreadId => ThreadId.makeUnsafe(crypto.randomUUID()); | ||
| 8 | |||
| 9 | export const newMessageId = (): MessageId => MessageId.makeUnsafe(crypto.randomUUID()); | ||
| 10 | |||
| 11 | |||
| 12 | export const asProjectId = (value: string): ProjectId => ProjectId.makeUnsafe(value); | ||
| 13 | |||
| 14 | export const asApprovalRequestId = (value: string): ApprovalRequestId => | ||
| 15 | ApprovalRequestId.makeUnsafe(value); | ||
apps/web/src/lib/utils.ts+9| ... | @@ -1,3 +1,4 @@ | ... | @@ -1,3 +1,4 @@ |
| 1 | import { CommandId, MessageId, ProjectId, ThreadId } from "@t3tools/contracts"; | ||
| 1 | import { type CxOptions, cx } from "class-variance-authority"; | 2 | import { type CxOptions, cx } from "class-variance-authority"; |
| 2 | import { twMerge } from "tailwind-merge"; | 3 | import { twMerge } from "tailwind-merge"; |
| 3 | 4 | ||
| ... | @@ -12,3 +13,11 @@ export function isMacPlatform(platform: string): boolean { | ... | @@ -12,3 +13,11 @@ export function isMacPlatform(platform: string): boolean { |
| 12 | export function isWindowsPlatform(platform: string): boolean { | 13 | export function isWindowsPlatform(platform: string): boolean { |
| 13 | return /^win(dows)?/i.test(platform); | 14 | return /^win(dows)?/i.test(platform); |
| 14 | } | 15 | } |
| 16 | |||
| 17 | export const newCommandId = (): CommandId => CommandId.makeUnsafe(crypto.randomUUID()); | ||
| 18 | |||
| 19 | export const newProjectId = (): ProjectId => ProjectId.makeUnsafe(crypto.randomUUID()); | ||
| 20 | |||
| 21 | export const newThreadId = (): ThreadId => ThreadId.makeUnsafe(crypto.randomUUID()); | ||
| 22 | |||
| 23 | export const newMessageId = (): MessageId => MessageId.makeUnsafe(crypto.randomUUID()); |