Skip to content

fix(editing): IPC 序列化总根因(camelCase 字段)+ 蓝色选中 + 递归导入 + 红绿灯位置#143

Merged
appergb merged 1 commit into
mainfrom
fix/editing-ipc-serde-and-polish
Jun 24, 2026
Merged

fix(editing): IPC 序列化总根因(camelCase 字段)+ 蓝色选中 + 递归导入 + 红绿灯位置#143
appergb merged 1 commit into
mainfrom
fix/editing-ipc-serde-and-polish

Conversation

@appergb

@appergb appergb commented Jun 24, 2026

Copy link
Copy Markdown
Owner

从集成分支 #141 抽出的干净、自包含修复子集,直接合 main(不夹带仍有 bug 的功能 PR)。

核心:剪辑套件失效的总根因(详见 #142)

serde 的 enum 级 #[serde(rename_all="camelCase")] 只改变体名、不改 struct 变体的字段名(已实测)。于是 EditRequest 里所有多词字段命令(clip_ids/clip_id/at_frame/track_index/offset_frames…)只认 snake_case,而前端发 camelCase → 整条命令反序列化失败、被 void 静默吞掉。删除时 toast 暴露:missing field 'clip_ids'

结果:拖入/移动/修剪(单词字段)正常,但删除、在播放头分割、Inspector 改属性、关键帧、Link/Unlink、文件夹操作全部静默失效——长期被误诊为"选中没生效"。main 上一直有此 bug。

修复:给 EditRequest 每个 struct 变体加 #[serde(rename_all="camelCase")] + 回归测试。

附带的自包含小修

  • 蓝色选中:选中片段边框由近白改醒目蓝 2px(原来发灰难辨)。
  • 递归导入:导入文件夹时递归导入整棵目录树下的媒体。
  • 红绿灯位置:macOS 交通灯下移 {x:18,y:24} + titlebar 安全区下移,标题留白。

验证

  • cargo test -p opentake-tauri edit_request_serde ✅(camelCase removeClips/splitClip/insertClips/rippleDeleteClips 均反序列化通过)
  • tsc ✅ · 52 前端测试 ✅ · vite build

关联

🤖 Generated with Claude Code

…ector/…) + blue selection + recursive folder import + traffic-light position

THE root cause of "the whole editing suite is broken": serde's enum-level
`#[serde(rename_all = "camelCase")]` renames variant NAMES but NOT the fields of
struct variants, so every EditRequest variant with a multi-word field (clip_ids,
clip_id, at_frame, track_index, offset_frames, …) expected snake_case while the
front end sends camelCase — the `command` arg failed to deserialize ("missing
field `clip_ids`") and the action silently did nothing. Only single-word-field
commands (AddClips/MoveClips/TrimClips) worked, which is why drag-in/move/trim
looked fine but Delete, Split-at-playhead, Duplicate, Inspector SetClipProperties,
all keyframe ops, Link/Unlink and folder ops never applied. Long misdiagnosed as
"selection not working".

- src-tauri/src/commands.rs: add `#[serde(rename_all = "camelCase")]` to every
  EditRequest struct variant + a regression test deserializing camelCase
  removeClips/splitClip/insertClips/rippleDeleteClips.
- clipRenderer: selected clips get a clear blue 2px outline (old near-white
  border read as grey).
- mediaActions: import folder recursively so nested media is imported.
- tauri.conf/tokens: nudge the macOS traffic lights down + widen the titlebar
  safe area so the sidebar title clears them.

Self-contained subset extracted from the integration branch (#141); the buggy
feature PRs and the preview/playback rewrite (#142) are tracked separately.
@appergb appergb merged commit 2c4d49d into main Jun 24, 2026
2 checks passed
@appergb appergb deleted the fix/editing-ipc-serde-and-polish branch June 24, 2026 08:21
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.

1 participant