diff --git a/apps/web/src/components/BranchToolbar.tsx b/apps/web/src/components/BranchToolbar.tsx index 374902ea6e58b8f9f9766e962365967bbc96dde6..904ef96e28a24b89d268c22d139cdd54d8208245 100644 --- a/apps/web/src/components/BranchToolbar.tsx +++ b/apps/web/src/components/BranchToolbar.tsx @@ -2,7 +2,7 @@ import type { GitBranch, ThreadId } from "@t3tools/contracts"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { useEffect, useState } from "react"; -import { newCommandId } from "../lib/orchestrationIds"; +import { newCommandId } from "../lib/utils"; import { gitBranchesQueryOptions, gitCheckoutMutationOptions, @@ -70,9 +70,7 @@ export default function BranchToolbar({ : branchNames; // ── Mutations ───────────────────────────────────────────────────────── - const checkoutMutation = useMutation( - gitCheckoutMutationOptions({ cwd: branchCwd, queryClient }), - ); + const checkoutMutation = useMutation(gitCheckoutMutationOptions({ cwd: branchCwd, queryClient })); const createBranchMutation = useMutation( gitCreateBranchAndCheckoutMutationOptions({ cwd: branchCwd, queryClient }), @@ -108,14 +106,7 @@ export default function BranchToolbar({ branch: syncedBranch, worktreePath: null, }); - }, [ - activeThreadId, - activeWorktreePath, - activeThreadBranch, - queryBranches, - envMode, - dispatch, - ]); + }, [activeThreadId, activeWorktreePath, activeThreadBranch, queryBranches, envMode, dispatch]); useEffect(() => { if (isBranchMenuOpen) return; diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index 1c528379f544537695ace20d620ef9fe57afd251..0adc025eba3cdd8b0abb6c8b4e708e55465ac947 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -103,7 +103,7 @@ import { } from "~/projectScripts"; import { Toggle } from "./ui/toggle"; import { SidebarTrigger } from "./ui/sidebar"; -import { newCommandId, newMessageId } from "~/lib/orchestrationIds"; +import { newCommandId, newMessageId } from "~/lib/utils"; import { readNativeApi } from "~/nativeApi"; function formatMessageMeta(createdAt: string, duration: string | null): string { diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsx index 3aef2b7f4b602a9a1a08858faba1631792fcae7c..99dcdb62ef3dd2a1edb7685886a5166aa9475039 100644 --- a/apps/web/src/components/Sidebar.tsx +++ b/apps/web/src/components/Sidebar.tsx @@ -11,7 +11,7 @@ import { useNavigate, useParams } from "@tanstack/react-router"; import { useAppSettings } from "../appSettings"; import { isElectron } from "../env"; import { APP_STAGE_LABEL } from "../branding"; -import { newCommandId, newProjectId, newThreadId } from "../lib/orchestrationIds"; +import { newCommandId, newProjectId, newThreadId } from "../lib/utils"; import { useStore } from "../store"; import { isChatNewLocalShortcut, isChatNewShortcut } from "../keybindings"; import { type Thread } from "../types"; diff --git a/apps/web/src/lib/orchestrationIds.ts b/apps/web/src/lib/orchestrationIds.ts deleted file mode 100644 index c288fdd4f519ffda632f3a92c98e0ac9754d1bb1..0000000000000000000000000000000000000000 --- a/apps/web/src/lib/orchestrationIds.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { ApprovalRequestId, CommandId, MessageId, ProjectId, ThreadId } from "@t3tools/contracts"; - -export const newCommandId = (): CommandId => CommandId.makeUnsafe(crypto.randomUUID()); - -export const newProjectId = (): ProjectId => ProjectId.makeUnsafe(crypto.randomUUID()); - -export const newThreadId = (): ThreadId => ThreadId.makeUnsafe(crypto.randomUUID()); - -export const newMessageId = (): MessageId => MessageId.makeUnsafe(crypto.randomUUID()); - - -export const asProjectId = (value: string): ProjectId => ProjectId.makeUnsafe(value); - -export const asApprovalRequestId = (value: string): ApprovalRequestId => - ApprovalRequestId.makeUnsafe(value); diff --git a/apps/web/src/lib/utils.ts b/apps/web/src/lib/utils.ts index d9d5575a5db50332532ee09e77b9781e8e97670b..7684e68d7720389a77a71f84636fe1c2e51d18e3 100644 --- a/apps/web/src/lib/utils.ts +++ b/apps/web/src/lib/utils.ts @@ -1,3 +1,4 @@ +import { CommandId, MessageId, ProjectId, ThreadId } from "@t3tools/contracts"; import { type CxOptions, cx } from "class-variance-authority"; import { twMerge } from "tailwind-merge"; @@ -12,3 +13,11 @@ export function isMacPlatform(platform: string): boolean { export function isWindowsPlatform(platform: string): boolean { return /^win(dows)?/i.test(platform); } + +export const newCommandId = (): CommandId => CommandId.makeUnsafe(crypto.randomUUID()); + +export const newProjectId = (): ProjectId => ProjectId.makeUnsafe(crypto.randomUUID()); + +export const newThreadId = (): ThreadId => ThreadId.makeUnsafe(crypto.randomUUID()); + +export const newMessageId = (): MessageId => MessageId.makeUnsafe(crypto.randomUUID());