Skip to content

Add sidebar upload progress toast and optional finish title#8308

Open
xfy0012 wants to merge 4 commits intomarimo-team:mainfrom
xfy0012:feat/upload-loading-bar
Open

Add sidebar upload progress toast and optional finish title#8308
xfy0012 wants to merge 4 commits intomarimo-team:mainfrom
xfy0012:feat/upload-loading-bar

Conversation

@xfy0012
Copy link

@xfy0012 xfy0012 commented Feb 13, 2026

Summary

This PR adds upload progress feedback for file uploads from the editor sidebar. issue(#8120).

Description of Changes

  1. Extended withLoadingToast (frontend/src/utils/download.ts) with an optional finishTitle argument.
  2. Updated sidebar file upload flow (frontend/src/components/editor/file-tree/upload.tsx) to reuse withLoadingToast.
  3. Wired upload progress updates by file count (progress.addTotal(...) + progress.increment(1)).
  4. Added tests in frontend/src/utils/__tests__/download.test.tsx for:
    • showing a finish toast when finishTitle is provided
    • not showing a finish toast when the operation fails

Behavior

  • During upload: a loading toast with progress bar is shown.
  • On success: loading toast dismisses, then a completion toast is shown.
  • On failure: loading toast dismisses and existing error handling remains unchanged.

Validation

  • pnpm --filter @marimo-team/frontend test src/utils/__tests__/download.test.tsx --run
  • pnpm turbo --filter @marimo-team/frontend typecheck

@vercel
Copy link

vercel bot commented Feb 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment Feb 14, 2026 11:10pm

Request Review

@github-actions
Copy link

github-actions bot commented Feb 13, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@xfy0012
Copy link
Author

xfy0012 commented Feb 13, 2026

I have read the CLA Document and I hereby sign the CLA

Comment on lines 34 to 36
if (finishTitle) {
toast({ title: finishTitle });
}
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of creating another toast, you can update the existing toast, toast.update. And maybe set a short timeout so the toast can be seen before dismissed.

Copy link
Author

Choose a reason for hiding this comment

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

updated this part: I now use loadingToast.update() instead of creating a secod toast, and set a short finish duration (1200ms)

@@ -40,30 +41,49 @@ export function useFileExplorerUpload(options: DropzoneOptions = {}) {
});
},
onDrop: async (acceptedFiles) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

just to check, this covers clicking on the upload button on the panel?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, it covers both click to upload and drag-drop.

export async function withLoadingToast<T>(
title: string,
fn: (progress: ProgressState) => Promise<T>,
finishTitle?: string,
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if you can do onFinish?: Toast, so it's more flexible how you can call this.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, updated to onFinish?: ToastConfig (replacing finishTitle?: string) so the finish toast is configurable beyond just the title.

@xfy0012
Copy link
Author

xfy0012 commented Feb 14, 2026

I also noticed a small UX edge case: if a drop includes both accepted and rejected files, users may see a rejection toast without a clear confirmation that the accepted files were uploaded successfully.

Would you like me to address this in a small follow-up PR by showing a combined summary message (e.g. “Uploaded N files, skipped M files”)?

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