Skip to content

Edit Project: icon/color changes not persisted to database for projects without independent records #37345

Description

@yiyinideshang

Description

When editing a project's icon or color through the Edit Project modal in the Desktop app, the changes are not saved to the project table in the SQLite database if the project does not have an independent record (i.e., its id is "global" or empty). The data is written only to the local workspace file (opencode.workspace.*.dat), which the sidebar does not read for display purposes. As a result, the user sees no visual change in the sidebar after saving.

I dug into the app.asar and found this in the save handler:

if (props.project.id && props.project.id !== "global") {
  // Has independent DB record → writes to `project` table
  await serverCtx().sdk.client.project.update({...});
} else {
  // No independent DB record → writes only to workspace file
  serverCtx().sync.project.meta(props.project.worktree, {...});
}

Projects that don't yet have an independent record in the project table (those falling back to the global row) always take the else branch. The resulting data is stored in opencode.workspace.*.dat — but the sidebar rendering layer does not read icon/color metadata from workspace files. It reads from the project table. Therefore, any changes are invisible.

Only projects that already have an independent row in the project table (e.g., created in earlier OpenCode versions before this behavior was introduced) will persist icon/color changes correctly.

Steps to Reproduce

  1. Open OpenCode Desktop on a workspace-style project that does not have its own row in the project table (most projects fall into this category).
  2. Click the project name → Edit Project.
  3. Change the project icon and/or accent color → Save.

Observe: the sidebar icon and color do not update.
Expected Behavior Editing a project's icon or color should persist to the database (or the sidebar should be updated to read from workspace files) so that the change is immediately visible in the sidebar.

Workaround Directly manipulate the SQLite database:

  • Database: opencode.db → project table

  • UPDATE project SET icon_url = NULL, color = NULL WHERE id = 'global';

  • After restarting the app, the sidebar will reflect the database values.

My Environment

OpenCode Desktop version: 1.18.3;
OS: Windows

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions