Polaris-react: [Dropzone] `numFiles` state doesn't get reset

Created on 20 Mar 2019  ·  3Comments  ·  Source: Shopify/polaris-react

Issue summary

If you're using Dropzone with allowMultiple being false, and you drop a image and then you clear the Dropzone, the numFiles state doesn't reset, stay at 1, not allowing the user to upload a new image.

Expected behavior

You should be able to reset the Dropzone numFiles state.

Actual behavior

You can't reset the Dropzone numFiles state.

Steps to reproduce the problem

In this PR you can see that I'm fixing it by adding a key prop to force an unmount https://github.com/Shopify/online-store-web/pull/2656

If you remove it, you can see that the numFiles state doesn't get reset when I click "Remove Image".

Reduced test case

The best way to get your bug fixed is to provide a reduced test case. This CodeSandbox template is a great starting point.

Specifications

  • Are you using the React components? (Y/N): Y
  • Polaris version number: 3.10
  • Browser: Chrome
  • Device: MacBook
  • Operating System: MacOS
🐛Bug

Most helpful comment

Any update on this issue?

I've created a sandbox to easily repro. Here are the steps

  • Click Add file and select a file
  • Once uploaded, click Remove image
  • Click Add file and select a file - no longer works

Edit p25kz7n1j

All 3 comments

Any update on this issue?

I've created a sandbox to easily repro. Here are the steps

  • Click Add file and select a file
  • Once uploaded, click Remove image
  • Click Add file and select a file - no longer works

Edit p25kz7n1j

Any update on this issue?

Issue is now resolved :)

Was this page helpful?
0 / 5 - 0 ratings