fix: persist project edits for global/no-ID projects - #31736
Conversation
Two changes to fix project edits (name, color, commands) not persisting for 'global' projects or projects without a server-side ID: 1. dialog-edit-project.tsx: After project.update() to the server, also call project.meta() to sync the icon color to the local store. Previously only the icon override was synced, not the color. 2. layout.tsx enrich(): Merge childStore.projectMeta on top of server metadata so user edits from the dialog take precedence over stale auto-assigned values. Without this, enriched() would read the old server-side icon.color (e.g. auto-assigned lime) and ignore the user's new choice (e.g. purple) stored in projectMeta. Fixes: project color, name, and commands not saving via edit dialog
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR ensures locally edited project metadata (e.g., from the edit dialog) takes precedence during layout metadata composition, and synchronizes icon color changes back to the server.
Changes:
- Merge
childStore.projectMetaon top of server/project metadata when composing the effective project object. - Persist edited icon color to the server via
serverSync().project.meta(...)in the edit dialog.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/app/src/context/layout.tsx | Prioritizes local projectMeta fields (name/icon/commands) when building the base project metadata. |
| packages/app/src/components/dialog-edit-project.tsx | Syncs icon color changes to the server when saving from the edit dialog. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| icon: { ...base.icon, ...meta.icon }, | ||
| commands: { ...base.commands, ...meta.commands }, |
| serverSync().project.icon(props.project.worktree, store.iconOverride || undefined) | ||
| serverSync().project.meta(props.project.worktree, { | ||
| icon: { color: store.color || undefined }, | ||
| }) |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
Hi maintainers @Hona @Brendonovich, this bug still exists in v1.16.2 (Windows 11). Project name, icon, and color edits are still not persisting after save/restart. This has been reported since Feb 2026 (#14465) and affects many users. The fix in this PR is only 16 lines - could we please get it reviewed and merged? Thanks! |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #31739
Type of change
What does this PR do?
Project edits (name, color, commands) made via the edit dialog don't persist for 'global' projects or projects without a server-side ID. The dialog closes without error, but re-opening shows the original values.
Root cause: When saving via the dialog, the icon color was never synced to the local store. Additionally, enrich() in the layout context always gave precedence to server-side metadata (which contained stale auto-assigned colors) over the local user edits stored in childStore.projectMeta.
Fix (two changes, 16 lines):
dialog-edit-project.tsx: After project.update() to the server, also call project.meta() to sync the icon color to the local store.
layout.tsx (enrich function): Merge childStore.projectMeta on top of server metadata so user edits from the dialog take precedence over stale auto-assigned values.
How did you verify your code works?
Checklist