Skip to content
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

[Feature] FileInput controlled state without file data #895

Merged
merged 21 commits into from
Feb 4, 2025

Conversation

LJKaski
Copy link
Collaborator

@LJKaski LJKaski commented Jan 28, 2025

Description

This PR brings a new feature to FileInput, which allows it to be used in controlled state without having to store the actual file data in the component state. This can be accomplished by providing the component with an object with the necessary metadata, and storing the actual file elsewhere.

Motivation and Context

This was a request from several projects, where there were forms with possibly tens of files added. Storing the actual file data in the component state got really unoptimal in those cases.

How Has This Been Tested?

Tested locally on styleguidist on chrome as well as in a React+Vite test project. Also tested in one of the projects that requested this feature.

Release notes

FileInput

  • File is no longer required in ControlledFileItem
    • Providing the necessary metadata for the component is now enough, which provides more flexibility in terms of where to store the file itself

@LJKaski LJKaski added the enhancement New feature or request label Jan 28, 2025
@LJKaski LJKaski self-assigned this Jan 28, 2025
@LJKaski LJKaski requested a review from riitasointi as a code owner January 28, 2025 10:04
@LJKaski LJKaski force-pushed the feature/file-input-pseudofile-support branch from 183c9ed to 20b42d1 Compare February 3, 2025 13:01
@LJKaski LJKaski merged commit 56cf0fc into develop Feb 4, 2025
1 check passed
@LJKaski LJKaski mentioned this pull request Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

Successfully merging this pull request may close these issues.

2 participants