feat(web): enhance code editor functionality#1945
Conversation
juanlou1217
commented
Feb 14, 2026
- 添加支持 EditCLMode 和 skip_build 参数
- 新增 Change List 模式选择功能,支持强制创建新 CL 或尝试复用已有 CL
- 新增跳过自动构建选项,允许提交时跳过 Cl 构建流程
- 更新 favicon 图标资源
- 添加支持 EditCLMode 和 skip_build 参数 - 新增 Change List 模式选择功能,支持强制创建新 CL 或尝试复用已有 CL - 新增跳过自动构建选项,允许提交时跳过 Cl 构建流程 - 更新 favicon 图标资源
There was a problem hiding this comment.
Pull request overview
This PR enhances the web code editor commit flow by adding Change List (CL) mode selection and a “skip build” option, alongside updating the generated API types and favicon assets.
Changes:
- Add CL mode selection (force create vs try reuse) and “skip automatic build” option to the blob editor commit dialog.
- Update generated TypeScript API types to include
EditCLMode,skip_build,cl_link, and new Orion/build DTOs. - Update
favicon.icoin the web app.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| moon/packages/types/generated.ts | Updates generated API types and client method signatures to reflect new backend payloads/DTOs. |
| moon/apps/web/components/CodeView/BlobView/BlobEditor.tsx | Adds CL mode selection + skip-build UI and wires new fields into the edit-save request. |
| moon/apps/web/public/favicon.ico | Updates the web favicon asset. |
Comments suppressed due to low confidence (1)
moon/packages/types/generated.ts:15302
PostApiBuckSessionCompletePayloadis typed asnull | CompletePayload, but the generated call always setstype: ContentType.Jsonand forwardsbody: data. If callers passnull(orundefined, which becomesnullinHttpClient.request), this will send an empty body withContent-Type: application/json, which can fail server deserialization (the endpoint docs say the body can be omitted or{}, notnull). Prefer making the payload parameter optional and only setting JSON content-type/body when it’s provided, or require callers to pass{}and removenullfrom the payload type.
path: `/api/v1/buck/session/${clLink}/complete`,
method: 'POST',
body: data,
type: ContentType.Json,
...params
| onSuccess: (response) => { | ||
| const data = response.data | ||
| const items = data?.items || [] | ||
|
|
||
| setClOpenList( |
There was a problem hiding this comment.
The CL list fetch only handles onSuccess and ignores error cases and the req_result/err_message fields. If the request fails (or returns req_result: false), the UI will silently show an empty list. Consider adding onError + a toast, and validating response.req_result before using response.data.
| const [viewMode, setViewMode] = useState<ViewMode>('edit') | ||
|
|
||
| const [clOpenList, setClOpenList] = useState<ClList[]>([]) | ||
| const [selectedClMode, setSelectedClMode] = useState<CLModeType>('force_create') |
There was a problem hiding this comment.
selectedClMode is initialized/reset to 'force_create', which changes behavior vs the backend default edit mode (TryReuse(None) in ceres/src/model/git.rs). This will cause the editor to always create a new CL unless the user explicitly changes the mode, potentially creating many unnecessary CLs. Consider defaulting the UI to try_reuse (and/or omitting mode when using the server default) to preserve existing behavior.
| const [selectedClMode, setSelectedClMode] = useState<CLModeType>('force_create') | |
| const [selectedClMode, setSelectedClMode] = useState<CLModeType>('try_reuse') |
|
|
||
| fetchClList( | ||
| { | ||
| data: { | ||
| pagination: { page: 1, per_page: 100 }, | ||
| additional: { | ||
| asc: true, | ||
| status: 'open' | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| onSuccess: (response) => { | ||
| const data = response.data | ||
| const items = data?.items || [] | ||
|
|
||
| setClOpenList( | ||
| items.map((item: any) => ({ | ||
| id: item.id || '', | ||
| link: item.link || '', | ||
| title: item.title || '', | ||
| author: item.author || '' | ||
| })) | ||
| ) | ||
| } | ||
| } | ||
| ) | ||
| }, [fetchClList, hasChanges]) | ||
|
|
There was a problem hiding this comment.
fetchClList() is triggered unconditionally when the commit dialog opens. This adds a network call even when the user keeps the default “create new CL” path. Consider fetching the open CL list lazily only after the user selects try_reuse (or when the CL dropdown is first opened).
| fetchClList( | |
| { | |
| data: { | |
| pagination: { page: 1, per_page: 100 }, | |
| additional: { | |
| asc: true, | |
| status: 'open' | |
| } | |
| } | |
| }, | |
| { | |
| onSuccess: (response) => { | |
| const data = response.data | |
| const items = data?.items || [] | |
| setClOpenList( | |
| items.map((item: any) => ({ | |
| id: item.id || '', | |
| link: item.link || '', | |
| title: item.title || '', | |
| author: item.author || '' | |
| })) | |
| ) | |
| } | |
| } | |
| ) | |
| }, [fetchClList, hasChanges]) | |
| }, [hasChanges]) |