Skip to content

fix(admin): avoid stale title overwrite in custom modal#1786

Merged
coltea merged 2 commits intochaitin:mainfrom
coltea:fix-admin-overwrite
Apr 15, 2026
Merged

fix(admin): avoid stale title overwrite in custom modal#1786
coltea merged 2 commits intochaitin:mainfrom
coltea:fix-admin-overwrite

Conversation

@coltea
Copy link
Copy Markdown
Collaborator

@coltea coltea commented Apr 15, 2026

PR 标题

修复管理端存在覆盖配置项的问题

变更类型

请勾选适用的变更类型:

  • Bug 修复 (不兼容变更的修复)
  • 新功能 (不兼容变更的新功能)
  • 功能改进 (不兼容现有功能的改进)
  • 文档更新
  • 依赖更新
  • 重构 (不影响功能的代码修改)
  • 测试用例
  • CI/CD 配置变更
  • 其他 (请描述):

变更内容

详细描述本次 PR 的具体变更内容:

  1. 修复管理端存在覆盖配置项的问题

测试情况

描述本次变更的测试情况:

  • 已本地测试
  • 已添加测试用例
  • 不需要测试 (理由: )

其他说明

任何其他需要说明的事项:

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

This PR fixes an admin-side issue where editing in the CustomModal could be overwritten by subsequent “hydration” from preview/config data, by stabilizing debounced updates and preventing initial form resets from triggering preview writes.

Changes:

  • Stabilize and clean up the debounced setAppPreviewData dispatcher hook.
  • Refactor Header/Footer config forms to use reset() for hydration and skip the first “sync back to preview” after hydrating.
  • Adjust effect dependencies/cleanup around preview updates.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
web/admin/src/hooks/useDebounceAppPreviewData.tsx Memoizes the debounced dispatcher and cancels it on unmount to avoid stale debounced callbacks.
web/admin/src/components/CustomModal/components/config/HeaderConfig.tsx Uses reset() + hydration guard to avoid overwriting user edits when preview data changes.
web/admin/src/components/CustomModal/components/config/FooterConfig.tsx Uses reset() + hydration guard to reduce unintended overwrites during initial hydration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coltea coltea merged commit c1981c5 into chaitin:main Apr 15, 2026
7 checks passed
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.

2 participants