summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-12-09 16:55:24 -0500
committerDax Raad <[email protected]>2025-12-09 16:55:26 -0500
commit132e772c2605cadaccce56080154f33f01462e89 (patch)
tree41016683a792401ec963b9452d625f39bbd35cea
parent62cbed57cc4958553a30b8bce1dc8c870a1b3fcf (diff)
downloadopencode-132e772c2605cadaccce56080154f33f01462e89.tar.gz
opencode-132e772c2605cadaccce56080154f33f01462e89.zip
core: fix project icon update handling to preserve existing icon properties
-rw-r--r--packages/opencode/src/project/project.ts19
1 files changed, 16 insertions, 3 deletions
diff --git a/packages/opencode/src/project/project.ts b/packages/opencode/src/project/project.ts
index bcae32f53..66ca737a2 100644
--- a/packages/opencode/src/project/project.ts
+++ b/packages/opencode/src/project/project.ts
@@ -129,7 +129,7 @@ export namespace Project {
export async function discover(input: Info) {
if (input.vcs !== "git") return
- if (input.icon) return
+ if (input.icon?.url) return
const glob = new Bun.Glob("**/{favicon}.{ico,png,svg,jpg,jpeg,webp}")
const matches = await Array.fromAsync(
glob.scan({
@@ -198,11 +198,24 @@ export namespace Project {
icon: Info.shape.icon.optional(),
}),
async (input) => {
- return await Storage.update<Info>(["project", input.projectID], (draft) => {
+ const result = await Storage.update<Info>(["project", input.projectID], (draft) => {
if (input.name !== undefined) draft.name = input.name
- if (input.icon !== undefined) draft.icon = input.icon
+ if (input.icon !== undefined) {
+ draft.icon = {
+ ...draft.icon,
+ }
+ if (input.icon.url !== undefined) draft.icon.url = input.icon.url
+ if (input.icon.color !== undefined) draft.icon.color = input.icon.color
+ }
draft.time.updated = Date.now()
})
+ GlobalBus.emit("event", {
+ payload: {
+ type: Event.Updated.type,
+ properties: result,
+ },
+ })
+ return result
},
)
}