A failed upload from a file drop or paste leaves a stuck "Loading..." block
维护者通常 1 天内回复
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- react, typescript
- 领域
- frontend, full-stack
调研方向
The report identifies handleFileInsertion, editor.uploadFile, and editor.updateBlock, but gives no file path or test name. Start by locating handleFileInsertion and tracing the drop and paste upload flow. Reproduce with uploadFile resolving to an empty string and with a rejected promise; done means a failed upload no longer leaves a Loading block and rejections are handled. An open linked pull request (#3247) already addresses this issue.
由索引模型根据 Issue 内容生成。
描述
What’s broken?
When uploadFile fails for a file that was dropped or pasted into the editor, the inserted file block keeps showing "Loading..." forever. The user has to delete it by hand.
handleFileInsertion inserts a file block, awaits editor.uploadFile(file, blockId) and then always calls editor.updateBlock(blockId, { props: { url } }).
- If
uploadFileresolves with""to report a failure, the props don't change, so the block doesn't render again. Its vanilla render replaced the "Add file" button with.bn-file-loading-previewinonUploadStart, and nothing restores it when the upload ends. - If
uploadFilerejects, the rejection isn't caught.updateBlocknever runs, the promise rejection is unhandled, and the block stays on "Loading..." as well.
The file panel's upload tab doesn't show this, because it sets name together with url. The block renders again and offers "Add file".
What did you expect to happen?
A failed upload doesn't leave a stuck placeholder. The block is either removed or goes back to its "Add file" state, and a rejected uploadFile is caught. A documented way for uploadFile to report a failure would help too.
Steps to reproduce
- Create an editor whose
uploadFilefails:const editor = useCreateBlockNote({ uploadFile: () => Promise.resolve(""), }); - Drag any file from your computer into the editor, or paste one.
- A file block showing "Loading..." stays in the document.
With uploadFile: () => Promise.reject(new Error("rejected")) the block stays as well, and the console shows an unhandled promise rejection.
BlockNote version
@blocknote/core, @blocknote/react, @blocknote/mantine 0.55.0
Environment
No response
Additional context
We work around it by listening to onUploadEnd and, in a timeout after BlockNote's updateBlock, removing the block if it still renders .bn-file-loading-preview.
Contribution
- I'd be interested in contributing a fix for this issue
Sponsor
- I'm a sponsor and would appreciate if you could look into this sooner than later 💖
- 主要语言
- TypeScript
- 星标
- 10.3k
- 派生
- 780
- 平均合并
- 3 天 6 小时
- 30 天内合并 PR
- 48
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
TypeCellOS/BlockNote 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
TypeCellOS/BlockNote#2949 · 1 条评论 ·
维护者通常 1 天内回复
-
a11y
难度 2/5 1-3 小时 新手友好度 68/100
TypeCellOS/BlockNote#2855 ·
维护者通常 1 天内回复
-
a11y
难度 2/5 1-3 小时 新手友好度 62/100
TypeCellOS/BlockNote#2829 · 1 条评论 ·
维护者通常 1 天内回复
-
Comment thread actions: hover-only controls and unlabeled buttons in ThreadsSideba可能已有人在做 @matthewlipski 于 1 天前认领。 未关闭a11y
难度 2/5 1-3 小时 新手友好度 72/100
TypeCellOS/BlockNote#2824 · 已指派 1 人 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 58/100
TypeCellOS/BlockNote#3245 ·
维护者通常 1 天内回复
查看 TypeCellOS/BlockNote 的全部 Issue
相似的 Issue
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
难度 2/5 1-3 小时 新手友好度 73/100
openclaw/openclaw#182077 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
aikido high security
难度 2/5 1-3 小时 新手友好度 75/100
dequelabs/axe-linter-action#161 ·
-
[Feature Request] Update the DimCode agent icon to the 45:32 brand mark可能已有人在做 @eric8810 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
lyswhut/lx-music-desktop#3026 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
abhigyanpatwari/GitNexus#3704 ·
维护者通常 1 天内回复