Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

refactor(store): migrate device-id hook to @multica/store

Naiyuan Qing5275bc55fca9
diff --git a/apps/web/app/components/chat.tsx b/apps/web/app/components/chat.tsx
index 943274d99e..e819c7e8b6 100644
--- a/apps/web/app/components/chat.tsx
+++ b/apps/web/app/components/chat.tsx
@@ -12,7 +12,7 @@ import { toast } from "@multica/ui/components/ui/sonner";
import { useMessages } from "../hooks/use-messages";
import { useGateway } from "../hooks/use-gateway";
import { useHubStore } from "@multica/store";
-import { useDeviceId } from "../hooks/use-device-id";
+import { useDeviceId } from "@multica/store";
import { useScrollFade } from "../hooks/use-scroll-fade";
import { cn } from "@multica/ui/lib/utils";
diff --git a/apps/web/app/hooks/use-gateway.ts b/apps/web/app/hooks/use-gateway.ts
index bda4fa0ff5..7416967635 100644
--- a/apps/web/app/hooks/use-gateway.ts
+++ b/apps/web/app/hooks/use-gateway.ts
@@ -1,6 +1,6 @@
import { useEffect, useRef, useState, useCallback } from "react"
import { GatewayClient, type ConnectionState, type RoutedMessage } from "@multica/sdk"
-import { useDeviceId } from "./use-device-id"
+import { useDeviceId } from "@multica/store"
import { GATEWAY_URL } from "../lib/config"
interface UseGatewayOptions {
diff --git a/packages/store/package.json b/packages/store/package.json
index c5b323df35..c9518c9739 100644
--- a/packages/store/package.json
+++ b/packages/store/package.json
@@ -10,6 +10,7 @@
"dependencies": {
"@multica/fetch": "workspace:*",
"react": "catalog:",
+ "uuid": "^13.0.0",
"zustand": "catalog:"
},
"devDependencies": {
diff --git a/apps/web/app/hooks/use-device-id.ts b/packages/store/src/device-id.ts
similarity index 97%
rename from apps/web/app/hooks/use-device-id.ts
rename to packages/store/src/device-id.ts
index 842d45518a..7f88fc6429 100644
--- a/apps/web/app/hooks/use-device-id.ts
+++ b/packages/store/src/device-id.ts
@@ -1,3 +1,5 @@
+"use client"
+
import { useSyncExternalStore } from "react"
import { v7 as uuidv7 } from "uuid"
diff --git a/packages/store/src/index.ts b/packages/store/src/index.ts
index 052edefc17..0f6fe37b09 100644
--- a/packages/store/src/index.ts
+++ b/packages/store/src/index.ts
@@ -1,3 +1,4 @@
export { useHubStore } from "./hub"
export type { HubInfo, Agent, HubStatus, HubStore } from "./hub"
export { useHubInit } from "./hub-init"
+export { useDeviceId } from "./device-id"
diff --git a/packages/ui/src/components/hub-sidebar.tsx b/packages/ui/src/components/hub-sidebar.tsx
index 99e34f4fca..dbbd4df8d6 100644
--- a/packages/ui/src/components/hub-sidebar.tsx
+++ b/packages/ui/src/components/hub-sidebar.tsx
@@ -68,7 +68,7 @@ export function HubSidebar() {
<SidebarGroup>
<SidebarGroupLabel>Agents</SidebarGroupLabel>
<SidebarGroupAction onClick={() => createAgent()} title="Create agent">
- <HugeiconsIcon icon={PlusSignIcon} strokeWidth={2} className="size-4" />
+ <HugeiconsIcon icon={PlusSignIcon} />
</SidebarGroupAction>
<SidebarGroupContent>
<SidebarMenu>
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 87608cd19a..d06f54bd64 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -285,6 +285,9 @@ importers:
react:
specifier: 'catalog:'
version: 19.2.3
+ uuid:
+ specifier: ^13.0.0
+ version: 13.0.0
zustand:
specifier: 'catalog:'