A failed upload from a file drop or paste leaves a stuck "Loading..." block
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 35/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- À l'abandon
- Stack technique
- react, typescript
- Domaine
- frontend, full-stack
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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 💖
- Langage dominant
- TypeScript
- Étoiles
- 10.3k
- Forks
- 780
- Merge moyen
- 3 j 6 h
- PR mergées (30 j)
- 48
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de TypeCellOS/BlockNote
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
TypeCellOS/BlockNote#2949 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
a11y
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
TypeCellOS/BlockNote#2855 ·
Les mainteneurs répondent en général sous 1 jour
-
a11y
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
TypeCellOS/BlockNote#2829 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Comment thread actions: hover-only controls and unlabeled buttons in ThreadsSidebaPeut-être pris @matthewlipski l’a pris il y a 1 jour. Ouvertea11y
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
TypeCellOS/BlockNote#2824 · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 4/5 3-5 jours Accessibilité débutants 58/100
TypeCellOS/BlockNote#3245 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de TypeCellOS/BlockNote
Issues similaires
-
bug hacktoberfest help wanted
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
libredb/libredb-studio#1941 ·
Les mainteneurs répondent en général sous 1 jour
-
chore other
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
alastair-smith/card-games#308 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 86/100
paperclipai/paperclip#17379 ·
Les mainteneurs répondent en général sous 1 jour
-
[good first issue, hacktoberfest] 🏯 Hacktoberfest Task - Add new Anime Quote 626 (good-first-issue)Ouvertecommunity first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulté 1/5 Moins d'une heure Accessibilité débutants 76/100
lingdojo/kana-dojo#33040 · 1 commentaire · 5 réactions ·
Les mainteneurs répondent en général sous 1 jour
-
bug mobile ui
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
Les mainteneurs répondent en général sous 1 jour