[WC-3361] FileUploader: enhance limits and feedback#2208
Conversation
430b80b to
4d8b53f
Compare
- Show "Maximum file count of X reached" message when dropzone is disabled - Make maxFilesPerUpload optional (empty/0 = unlimited) - Add maxFilesPerBatch property to cap server commits per drop event - Split drops by remaining capacity — excess files shown as errors, not silently rejected - Auto-retry limit/batch-exceeded files when capacity is freed - Batch/limit-exceeded files survive dismissValidationErrors and re-queue correctly - Retry order matches visual list order (newest first) - Reorder file list: accepted files above rejected files
a444b83 to
7d054a3
Compare
AI Code Review
What was reviewed
Skipped (out of scope): Findings🔶 Medium — MobX reaction is never disposedFile: // In class body:
_disposeRetryReaction: (() => void) | undefined;
// In constructor, replace:
reaction(...);
// With:
this._disposeRetryReaction = reaction(...);
// Add a dispose method called from useRootStore cleanup:
dispose(): void {
this._disposeRetryReaction?.();
}Then in useEffect(() => {
return () => rootStore.dispose();
}, [rootStore]);🔶 Medium — Direct MobX state mutation outside action in
|
AI Code Review
What was reviewed
Skipped (out of scope): Findings🔶 Medium — Function declaration before imports in test fileFile: import { Big } from "big.js";
import { DynamicValue } from "mendix";
import { actionValue, dynamic, ListValueBuilder, obj } from "@mendix/widget-plugin-test-utils";
import { FileUploaderContainerProps } from "../../../typings/FileUploaderProps";
import { FileUploaderStore } from "../FileUploaderStore";
import { TranslationsStore } from "../TranslationsStore";
function unavailableDynamic(): DynamicValue<Big> {
return { status: "unavailable", value: undefined } as unknown as DynamicValue<Big>;
}
|
9fe41dd to
09489e2
Compare
AI Code Review
What was reviewed
Skipped (out of scope): Findings🔶 Medium — Dead
|
AI Code Review
What was reviewed
Skipped (out of scope): Findings
|
Pull request type
Bug fix (non-breaking change which fixes an issue)
Description
When the file upload limit was reached, the dropzone silently turned grey with no explanation to the user. Dropping more files than the limit allowed rejected the entire batch, and files stuck in error state had no way to recover.
IMPORTANT NOTE: we need to merge [WC-3363 Fileuploader: dismiss action for validation errors](#2198 (comment)) first
This PR addresses everything below:
maxFilesPerUploadfixedrequired="false"added;0and empty both mean unlimited (default)What should be covered while testing?
Setup: File Uploader, "Maximum number of files" = 5, "Maximum files per upload batch" = 2, files mode.
File limit feedback:
Unlimited behavior:
5. Set total limit = 0 → dropzone never disables regardless of file count
6. Leave total limit empty → same as 0, unlimited
Drop total limit:
7. Set total limit = 3, no batch limit. Drop 5 files → first 3 upload, last 2 appear as errors with "Maximum file count of 3 reached."
8. Remove 1 uploaded file → one of the errored files automatically starts uploading
Batch limit:
9. Set batch limit = 2, drop 5 files → first 2 upload, remaining 3 appear as errors: "File not uploaded. Batch limit of 2 files per drop was reached."
10. Remove 1 uploaded file → one of the batch-errored files automatically starts uploading (respects batch limit, max 2 retry at once)
11. Leave batch limit empty → all dropped files upload regardless of count per drop
List ordering:
12. Upload a mix of valid and invalid files → successful uploads appear above rejected files in the list
Other:
13. Read-only mode → dropzone not rendered, no regression
14. Image upload mode → same limit-reached and retry behavior applies