Skip to content

fix: Loading indicator when dropping/pasting files #1069

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Sep 18, 2024

Conversation

matthewlipski
Copy link
Collaborator

This PR adds a loading prop to the default file blocks, which causes them to render a Loading... indicator when true. Unfortunately, the delay is happening in editor.uploadFile, which is not really related to the block itself. So that means we don't have an existing way of checking if a file is being uploaded while the block is rendered.

Copy link

vercel bot commented Sep 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
blocknote ✅ Ready (Inspect) Visit Preview Sep 18, 2024 2:57pm
blocknote-website ✅ Ready (Inspect) Visit Preview Sep 18, 2024 2:57pm

Copy link
Collaborator

@YousefED YousefED left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think a loading prop is suitable for this. For example:

  • It will mean the "loading" value will be part of the (stored) document and stored in the db
  • it will conflict with history (undo / redo, etc)

we'll need to brainstorm a different architecture

@matthewlipski
Copy link
Collaborator Author

Do you have anything in mind? I was thinking we could expose an editor.fileUploadInProgress property which stores undefined or a block ID depending on if a file is currently being uploaded, and which file block it's being uploaded for. Then ig we can check that in the render function and avoid setting it in the state. Does this sound like a reasonable idea?

@matthewlipski matthewlipski merged commit 68dcdeb into main Sep 18, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants