【Auto】Fix Upload: toggle visible 后受控 fileList 的 blob URL 失效(ERR_FILE_NOT_FOUND)#3130
Open
SudoUserReal wants to merge 1 commit intomainfrom
Open
【Auto】Fix Upload: toggle visible 后受控 fileList 的 blob URL 失效(ERR_FILE_NOT_FOUND)#3130SudoUserReal wants to merge 1 commit intomainfrom
SudoUserReal wants to merge 1 commit intomainfrom
Conversation
…失效(ERR_FILE_NOT_FOUND) This commit was automatically generated by Semi Issue Solver. Closes #3122
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 4b93a98:
|
semi-design
|
||||||||||||||||||||||||||||||
| Project |
semi-design
|
| Branch Review |
solve/issue-3122-1770116513425
|
| Run status |
|
| Run duration | 08m 10s |
| Commit |
|
| Committer | SudoUser |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
0
|
|
|
13
|
|
|
0
|
|
|
291
|
Upgrade your plan to view test results. | |
| View all changes introduced in this branch ↗︎ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联 Issue: #3122([BUG] Upload component toggle visible file item blob ERR_FILE_NOT_FOUND)
问题概述
在受控
fileList场景中,Upload组件通过条件渲染(toggle visible)卸载/重挂载后,列表项里用于预览/展示的blob:URL 会失效,浏览器报ERR_FILE_NOT_FOUND,导致缩略图/预览异常。根因是组件卸载时触发了
URL.revokeObjectURL释放了仍被父组件保留并继续复用的 objectURL。解决方案说明
将 objectURL 的释放时机从“组件卸载即统一释放”调整为“文件项真正从列表移除或 URL 被替换时再释放”,避免受控
fileList在组件卸载期间持有的blob:URL 被提前 revoke,同时仍确保在移除/清空等真实释放场景下回收内存。主要变更点
UploadFoundation的内存释放策略:不再在destroy/unmount阶段无条件 revoke 仍可能被外部复用的 objectURL(packages/semi-foundation/upload/foundation.ts)packages/semi-ui/upload/index.tsx)fileList+ toggle visible”时不应 revoke objectURLpackages/semi-ui/upload/__test__/upload.test.js)测试说明
blob:URL 失效,并验证移除/清空会触发revokeObjectURL回收。