From 56540f83125d8ec3fd6f26ac7edca7471c2aca3f Mon Sep 17 00:00:00 2001
From: Adam <2363879+adamdotdevin@users.noreply.github.com>
Date: Wed, 10 Dec 2025 17:30:53 -0600
Subject: wip(desktop): progress

---
 packages/desktop/src/context/layout.tsx | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

(limited to 'packages/desktop/src/context/layout.tsx')

diff --git a/packages/desktop/src/context/layout.tsx b/packages/desktop/src/context/layout.tsx
index 1de8550cb..5530ad28f 100644
--- a/packages/desktop/src/context/layout.tsx
+++ b/packages/desktop/src/context/layout.tsx
@@ -48,9 +48,10 @@ export const { use: useLayout, provider: LayoutProvider } = createSimpleContext(
         open: undefined as undefined | "provider" | "model",
       },
     })
+    const usedColors = new Set<string>()
 
     function pickAvailableColor() {
-      const available = PASTEL_COLORS.filter((c) => !colors().has(c))
+      const available = PASTEL_COLORS.filter((c) => !usedColors.has(c))
       if (available.length === 0) return PASTEL_COLORS[Math.floor(Math.random() * PASTEL_COLORS.length)]
       return available[Math.floor(Math.random() * available.length)]
     }
@@ -69,6 +70,7 @@ export const { use: useLayout, provider: LayoutProvider } = createSimpleContext(
     function colorize(project: Project & { expanded: boolean }) {
       if (project.icon?.color) return project
       const color = pickAvailableColor()
+      usedColors.add(color)
       project.icon = { ...project.icon, color }
       globalSdk.client.project.update({ projectID: project.id, icon: { color } })
       return project
@@ -76,14 +78,6 @@ export const { use: useLayout, provider: LayoutProvider } = createSimpleContext(
 
     const enriched = createMemo(() => store.projects.flatMap(enrich))
     const list = createMemo(() => enriched().flatMap(colorize))
-    const colors = createMemo(
-      () =>
-        new Set(
-          list()
-            .map((p) => p.icon?.color)
-            .filter(Boolean),
-        ),
-    )
 
     async function loadProjectSessions(directory: string) {
       const [, setStore] = globalSync.child(directory)
-- 
cgit v1.2.3

