fix(media): retry image loading for pasted clipboard images#1928
fix(media): retry image loading for pasted clipboard images#1928
Conversation
Code Review:fix(media): retry image loading for pasted clipboard images (#1928)变更概述本 PR 修复了粘贴剪贴板图片后出现「Image not found」占位图永远不消失的竞态问题。在 方案评估结论:✅ 方案合理 方案正确识别了根本原因( 问题清单🔵 LOW — 不必要的三元表达式文件: 问题代码: preview={imageUrl ? true : false}问题说明:oxlint 修复建议: preview={!!imageUrl}🔵 LOW — 未使用的
|
| # | 严重级别 | 文件 | 问题 |
|---|---|---|---|
| 1 | 🔵 LOW | FilePreview.tsx:121 |
不必要的三元表达式 |
| 2 | 🔵 LOW | FilePreview.dom.test.tsx:7 |
未使用的 waitFor 导入 |
结论
✅ 批准合并 — 代码逻辑正确,方案合理,测试覆盖充分。仅存在两个 lint 级别的小问题,不影响功能。
本报告由本地 pr-review skill 生成,包含完整项目上下文,无截断限制。
CONCLUSION: APPROVED
IS_CRITICAL_PATH: false
PR_NUMBER: 1928
…ce condition When pasting clipboard images, buildDisplayMessage rewrites the temp file path to a workspace path before the backend finishes copying the file. FilePreview's getImageBase64 call would fail with ENOENT and permanently show the 'Image not found' placeholder SVG. Add retry logic (up to 5 retries, 800ms apart) that detects the placeholder response and re-attempts loading. Once the backend copy completes, the retry succeeds and the image renders correctly. Closes #794, closes #1170
8ee595b to
84b9fdc
Compare
|
✅ 已自动 review,无阻塞性问题,正在触发自动合并。 |
Summary
buildDisplayMessagerewrites temp file paths to workspace paths before backendcopyFilesToDirectorycompletes, soFilePreview.getImageBase64gets ENOENT and returns a placeholder SVG that never gets retriedFilePreviewthat detects the placeholder SVG and re-attempts loadingRelated Issues
Closes #794, closes #1170
Test Plan