Skip to content

Conversation

@chr33s
Copy link

@chr33s chr33s commented Apr 30, 2025

To support uncontrolled component use case. [**]

WHY are these changes introduced?

[**]

WHAT is this pull request doing?

[**]

How to 🎩

n/a

🎩 checklist

@MichaelFD28
Copy link

Amazing! Thanks man

To enable uncontrolled component use cases
@MichaelFD28
Copy link

Any update on this PR being approved?

Copilot AI review requested due to automatic review settings August 25, 2025 06:30
Copy link

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 adds a name prop to the DropZone component to support uncontrolled component use cases by allowing a name attribute on the underlying file input element.

  • Added optional name prop to DropZoneProps interface
  • Passed the name prop to the internal file input element
  • Removed automatic clearing of the input value to preserve form behavior
Comments suppressed due to low confidence (1)

polaris-react/src/components/DropZone/DropZone.tsx:233

  • Removing the automatic clearing of event.target.value = '' may cause issues where the same file cannot be selected again after being dropped or selected once. This is because the file input won't trigger an onChange event if the same file is selected. Consider making this behavior conditional based on whether the component is controlled or uncontrolled.
      if (!(event.target && 'value' in event.target)) return;

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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