Skip to content

fix: wizardDraftToAppSchema missing icon/label/branding fields#786

Merged
hotlong merged 4 commits intomainfrom
copilot/fix-top-nav-application-visibility
Feb 23, 2026
Merged

fix: wizardDraftToAppSchema missing icon/label/branding fields#786
hotlong merged 4 commits intomainfrom
copilot/fix-top-nav-application-visibility

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 23, 2026

Editing an app via the wizard and saving would silently drop icon, label, and branding fields from the persisted AppSchema, causing the app to vanish from the sidebar and app switcher.

Root cause

wizardDraftToAppSchema() only mapped title, logo, favicon, layout, navigation — omitting icon, label, and branding. EditAppPage then overwrote the full app config with this incomplete schema.

Changes

  • packages/types/src/app.ts — Add icon, label, branding, active to AppSchema interface. Map icon, label (from title), and branding in wizardDraftToAppSchema().
  • apps/console/src/pages/EditAppPage.tsx — Merge wizard output over original app config ({ ...appToEdit, ...appSchema }) so fields not managed by the wizard (e.g. active, actions, areas) are preserved.
  • packages/types/src/__tests__/app-creation-types.test.ts — Add assertions for icon, label, branding round-tripping; add edge cases for missing icon and sidebar/app-switcher display.
  • apps/console/src/__tests__/app-creation-integration.test.tsx — Add integration test verifying EditAppPage merge preserves original app fields (active) while including wizard-generated fields (label, icon, branding). Updated mock wizard onComplete to include icon matching real wizard behavior.
// Before
export function wizardDraftToAppSchema(draft: AppWizardDraft): AppSchema {
  return {
    type: 'app',
    name: draft.name,
    title: draft.title,
    // ❌ icon, label, branding all missing
    logo: draft.branding.logo,
    favicon: draft.branding.favicon,
    layout: draft.layout,
    navigation: draft.navigation,
  };
}

// After
export function wizardDraftToAppSchema(draft: AppWizardDraft): AppSchema {
  return {
    type: 'app',
    name: draft.name,
    title: draft.title,
    label: draft.title,
    icon: draft.icon,
    logo: draft.branding.logo,
    favicon: draft.branding.favicon,
    branding: draft.branding,
    layout: draft.layout,
    navigation: draft.navigation,
  };
}

Testing

  • ✅ 54 test files, 736 passed, 2 skipped
  • ✅ 11 type tests covering wizardDraftToAppSchema field mapping and edge cases
  • ✅ 14 console integration tests including merge preservation verification
  • ✅ CodeQL security scan: 0 alerts
Original prompt

This section details on the original issue you should resolve

<issue_title>【Bug】编辑应用后顶部导航/应用切换消失:wizardDraftToAppSchema 未同步 icon/label 字段导致</issue_title>
<issue_description>### 现象
通过"应用向导"编辑应用并保存后,顶部导航和应用切换下拉菜单中部分应用消失(或名称/图标为空),无法切换到原来的应用。

复现步骤

  1. 进入应用,例如"应用A"
  2. 点击"编辑应用"进入应用向导,做任意修改后保存
  3. 返回顶部导航/应用切换
  4. 发现当前或原有应用消失/名称为空/图标丢失

期望结果

  • 编辑和保存后,顶部导航/应用切换下拉应正确显示所有应用,包括名称(label)、图标(icon)
  • 编辑保存不应导致已存在的 app 配置字段丢失

问题分析

  • packages/types/src/app.ts 的 wizardDraftToAppSchema 只保存了 draft.title、logo、favicon 等字段,未保存 icon/label/branding/active 等
  • sidebar 工程中的 AppSidebar 依赖 app.label / app.icon 显示应用切换
  • 编辑/保存时,EditAppPage 直接用 wizardDraftToAppSchema 结果覆盖了原始 AppSchema,导致字段丢失
  • 实际保存后,后端返回数据缺少 label 和 icon,侧边栏就找不到应用条目

建议修复方案

  • 补全 wizardDraftToAppSchema 的字段:icon、label、branding、active
  • EditAppPage 保存时,和原始 app 配置做 merge 保留未在向导中维护的字段
  • 修复后确保 pnpm test、storybook、手动检查(已有测试可覆盖该场景)

受影响文件

  • packages/types/src/app.ts
  • apps/console/src/pages/EditAppPage.tsx
  • apps/console/src/pages/CreateAppPage.tsx
  • apps/console/src/components/AppSidebar.tsx

该问题会直接影响用户正常切换 app,建议优先修复。</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectui Ready Ready Preview, Comment Feb 23, 2026 11:41am
objectui-demo Error Error Feb 23, 2026 11:41am
objectui-storybook Error Error Feb 23, 2026 11:41am

Request Review

…; EditAppPage merges with original app

Fixes the bug where editing an app via the wizard would lose icon/label/branding
fields, causing the app to disappear from the sidebar and app switcher.

Changes:
- Added icon, label, branding, active fields to AppSchema interface
- Updated wizardDraftToAppSchema to output icon, label, and branding
- EditAppPage now merges wizard output with original app config
- Added test coverage for icon/label preservation

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
…tests

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix disappearing applications in top navigation after editing fix: wizardDraftToAppSchema missing icon/label/branding fields Feb 23, 2026
Copilot AI requested a review from hotlong February 23, 2026 11:05
@hotlong
Copy link
Copy Markdown
Collaborator

hotlong commented Feb 23, 2026

@copilot 仔细评估是否已经完成了所有的开发要求

…inal app fields

Enhances the mock wizard onComplete to include icon field (matching real
wizard behavior) and adds a dedicated test verifying:
- label, icon, branding are present in saved schema (from wizard)
- active is preserved from original app config (not in wizard)

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Feb 23, 2026

@copilot 仔细评估是否已经完成了所有的开发要求

已逐条核对 issue 中的全部开发要求,补充了缺失的集成测试,现已全部完成:

Issue 要求 vs 实现状态:

  1. 补全 wizardDraftToAppSchema 字段iconlabelbranding 已添加(active 不属于 AppWizardDraft,通过 EditAppPage merge 保留)
  2. EditAppPage merge 保留未维护字段{ ...appToEdit, ...appSchema } 保留 activeactionsareas
  3. AppSchema 接口补全 — 新增 iconlabelbrandingactive 字段定义
  4. 测试覆盖 — 新增集成测试验证 merge 后 label/icon/branding 来自 wizard,active 来自原始配置

受影响文件:

  • packages/types/src/app.ts ✅ 已修改
  • apps/console/src/pages/EditAppPage.tsx ✅ 已修改
  • apps/console/src/pages/CreateAppPage.tsx — 无需修改(wizardDraftToAppSchema 修复后新建应用已包含完整字段)
  • apps/console/src/components/AppSidebar.tsx — 无需修改(问题根因是数据缺失,非渲染逻辑)

测试结果: 54 文件全部通过,736 passed / 2 skipped (c0d87d9)

@hotlong hotlong marked this pull request as ready for review February 23, 2026 11:43
Copilot AI review requested due to automatic review settings February 23, 2026 11:43
@hotlong hotlong merged commit 9b95ca5 into main Feb 23, 2026
3 of 5 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a console bug where editing/saving an app via the AppCreationWizard would persist an incomplete AppSchema, dropping metadata (icon, label, branding) needed for sidebar/app-switcher display.

Changes:

  • Extend AppSchema and update wizardDraftToAppSchema() to include label, icon, and branding.
  • Update EditAppPage to merge wizard output over the original app config before saving, preserving non-wizard fields (e.g. active, actions, areas).
  • Add/adjust unit + integration tests to cover round-tripping and merge preservation; update roadmap test counts.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/types/src/app.ts Adds label/icon/branding/active to AppSchema and maps wizard draft fields into the schema.
packages/types/src/tests/app-creation-types.test.ts Adds assertions and edge cases for icon/label/branding mapping.
apps/console/src/pages/EditAppPage.tsx Saves merged schema to avoid dropping app fields not managed by the wizard.
apps/console/src/tests/app-creation-integration.test.tsx Updates wizard mock output and adds an integration test ensuring merge preserves active.
ROADMAP.md Updates documented test counts and notes about field preservation behavior.

Comment thread packages/types/src/app.ts
Comment on lines 165 to +200
@@ -177,6 +187,17 @@ export interface AppSchema extends BaseSchema {
*/
favicon?: string;

/**
* Branding configuration
*/
branding?: BrandingConfig;

/**
* Whether the application is active (visible in app switcher)
* @default true
*/
active?: boolean;

Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TypeScript AppSchema now includes label, icon, branding, and active, but the corresponding Zod validator (packages/types/src/zod/app.zod.tsAppSchema) does not include these fields. Because Zod object schemas strip unknown keys by default, any code that validates/parses an AppSchema via Zod could silently drop these new fields again. Please update the Zod AppSchema to accept these properties (and ideally add a small Zod test case covering them) to keep runtime validation in sync with the TS interface.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

【Bug】编辑应用后顶部导航/应用切换消失:wizardDraftToAppSchema 未同步 icon/label 字段导致

3 participants