fix: resolve TypeScript compile errors in PreviewVideoPanel #1386
Reference in New Issue
Block a user
Delete Branch "fix/ts-compile-error-preview-panel"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
问题
PR #1382 合并后引入多处 TypeScript 编译错误和 ESLint warnings,导致 develop CI 全链路阻断。
修复内容
PreviewVideoPanel.tsx
showTitlePreview的重复声明(接口定义 + prop 解构),保留const showTitlePreview = !!titleSettings作为唯一声明import TitlePreviewCanvas from "./title/TitlePreviewCanvas"Step4TitleSettings.tsx
import TitlePreviewCanvasTitlePreviewCanvas.tsx
eslint-disable-next-line注释(1×no-explicit-any+ 3×exhaustive-deps)GeneratePage.tsx
import { useQuery } from "@tanstack/react-query"import { getAssetsByKind } from "@/api/assets"showTitlePreviewprop(该值已在组件内部从 titleSettings 派生)改动统计
4 files changed
52b00c78fatod201866bd3d201866bd3to54642bd25c🚀 预览环境已部署
54642bd25cto797c81252a代码审查结果 - PR #1386
⚠️ 问题(0个需要修改)
无
💡 建议(3个可选)
apps/web/src/pages/generate/GeneratePage.tsx 第28-29行:存在未使用的导入
useQuery和getAssetsByKind但在当前 diff 中未使用。如果是后续代码需要使用请忽略,否则建议删除以减少包体积和保持代码整洁。apps/web/src/pages/generate/components/PreviewVideoPanel.tsx 第19行:新增导入的使用存疑
TitlePreviewCanvas组件,但在提供的 diff 片段中未看到其在 JSX 中的使用。如果该组件用于渲染标题预览,请确保其已被正确挂载;如果未使用,请删除导入。apps/web/src/pages/generate/components/title/TitlePreviewCanvas.tsx 第112、116、132行:React Hooks 依赖项审查
eslint-disable-next-line忽略exhaustive-deps规则。虽然注释说明 "draw uses refs",但请务必确保draw函数内部仅依赖 refs(如canvasRef)或通过参数传递数据。如果draw依赖了组件内的其他 state 或 props(且这些未列入依赖数组),会导致闭包陷阱,绘制的是旧数据。建议在 Code Review 中确认draw的实现细节。✅ 格式检查通过 | ✅ 逻辑审查需修改 | ✅ 建议关注性能
🤖 由 AI 代码审查机器人自动生成 | 2026-08-16 01:07:07 | 模型:
CI全绿,自动审批通过。
CI全绿,自动审批通过。
🗑️ 预览环境已清理
PR #1386 已关闭或合并,对应的预览环境已被清理。