Skip to content

Conversation

@marker-dao
Copy link
Contributor

No description provided.

@marker-dao marker-dao self-assigned this Oct 28, 2025
Copilot AI review requested due to automatic review settings October 28, 2025 16:11
@marker-dao marker-dao requested a review from a team as a code owner October 28, 2025 16:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements an internal file count limitation feature for the FileUploader component. The feature allows developers to set a maximum number of files that can be uploaded and provides a callback when this limit is reached.

Key Changes:

  • Added _maxFileCount option to limit the number of files that can be selected
  • Implemented onFileLimitReached event callback that fires when the file limit is exceeded
  • Added file count validation for both file input selection and drag-and-drop operations

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/devextreme/js/__internal/ui/file_uploader/file_uploader.types.ts Added type definitions for FileLimitReachedEvent and the _maxFileCount and onFileLimitReached options
packages/devextreme/js/__internal/ui/file_uploader/file_uploader.ts Implemented file limit validation logic, event handling, and integration with file input and drag-drop workflows
packages/devextreme/testing/tests/DevExpress.ui.widgets.editors/fileUploader.tests.js Added comprehensive test coverage for the file limit feature across multiple scenarios

Comment on lines 528 to 531
if (this._isFileLimitReached(files as unknown as File[])) {
this._fileLimitReachedAction?.();
}
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

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

The file limit check in _createFiles() incorrectly checks if the current files already exceed the limit, but doesn't prevent the files from being processed. This check should occur before files are added to the component, not after. The check here will always pass the current value to _isFileLimitReached, which will compare files.length + files.length, effectively doubling the count. This logic should be removed as the limit is already enforced in _inputChangeHandler and _dropHandler.

Suggested change
if (this._isFileLimitReached(files as unknown as File[])) {
this._fileLimitReachedAction?.();
}
// File limit is enforced in _inputChangeHandler and _dropHandler

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

@marker-dao marker-dao Oct 28, 2025

Choose a reason for hiding this comment

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

This logic is necessary when programmatically changing the value option or during the first render. But we can remove it after discussion with the team.

Copilot AI review requested due to automatic review settings October 29, 2025 07:46
@marker-dao marker-dao force-pushed the 25_2_fileuploader_limit_files branch from 3cb4bd3 to 11e53e6 Compare October 29, 2025 07:46

This comment was marked as outdated.

@marker-dao marker-dao merged commit a39f0af into DevExpress:25_2 Oct 29, 2025
149 of 150 checks passed
@marker-dao marker-dao deleted the 25_2_fileuploader_limit_files branch October 29, 2025 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants