summaryrefslogtreecommitdiffhomepage
path: root/packages/desktop/src/context/layout.tsx
diff options
context:
space:
mode:
authorAdam <[email protected]>2025-12-19 14:38:25 -0600
committerAdam <[email protected]>2025-12-20 04:25:16 -0600
commit742cf10deeffb31292cdbf8a5ca7afb07698d9dc (patch)
treec3f6f7269527bae0c1f4cdea2bc3a7ebd37cdfe2 /packages/desktop/src/context/layout.tsx
parent7664453f947f736ccf4710e90bae4ac24511decc (diff)
downloadopencode-742cf10deeffb31292cdbf8a5ca7afb07698d9dc.tar.gz
opencode-742cf10deeffb31292cdbf8a5ca7afb07698d9dc.zip
fix(desktop): removed projects
Diffstat (limited to 'packages/desktop/src/context/layout.tsx')
-rw-r--r--packages/desktop/src/context/layout.tsx13
1 files changed, 8 insertions, 5 deletions
diff --git a/packages/desktop/src/context/layout.tsx b/packages/desktop/src/context/layout.tsx
index 01e0bdf52..b30d3f350 100644
--- a/packages/desktop/src/context/layout.tsx
+++ b/packages/desktop/src/context/layout.tsx
@@ -61,21 +61,22 @@ export const { use: useLayout, provider: LayoutProvider } = createSimpleContext(
function enrich(project: { worktree: string; expanded: boolean }) {
const metadata = globalSync.data.project.find((x) => x.worktree === project.worktree)
- if (!metadata) return []
return [
{
...project,
- ...metadata,
+ ...(metadata ?? {}),
},
]
}
- function colorize(project: Project & { expanded: boolean }) {
+ function colorize(project: Partial<Project> & { worktree: string; 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 } })
+ if (project.id) {
+ globalSdk.client.project.update({ projectID: project.id, icon: { color } })
+ }
return project
}
@@ -95,7 +96,9 @@ export const { use: useLayout, provider: LayoutProvider } = createSimpleContext(
projects: {
list,
open(directory: string) {
- if (store.projects.find((x) => x.worktree === directory)) return
+ if (store.projects.find((x) => x.worktree === directory)) {
+ return
+ }
globalSync.project.loadSessions(directory)
setStore("projects", (x) => [{ worktree: directory, expanded: true }, ...x])
},