question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

files state of FileUploaderDropContainer is remembered and not cleaned up!

See original GitHub issue

What package(s) are you using?

  • carbon-components
  • carbon-components-react

Summary

I used the FileUploaderDropContainer from this component ProjectDropContainer: Sandbox: https://codesandbox.io/s/brave-voice-bdrx0

but I used it inside a Modal this time. After selecting a file, and closing the Modal then reopining it again the last selected file is still shown there! despite there is this line of code that should clean it:

const [files, setFiles] = useState([]);

Relevant information

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
zbeedatmcommented, Nov 15, 2019

Thanks a lot. I used a hook for ComponentWillUnmout and cleared the files inside:

`function ProjectDropContainer(props) { const [files, setFiles] = useState([]);

// useEffect(() => {
//     console.log('mounted')
// }, []);

useEffect(() => {
    return () => {
        // console.log('will unmount');
        setFiles([])
    }
}, []);`
0reactions
asudohcommented, Nov 14, 2019

Closing as a valid answer has been provided.

Read more comments on GitHub >

github_iconTop Results From Across the Web

FileUploader - Carbon Components React
Name Description Default buttonKind Specify the type of the . ButtonKinds 'primary' disabled Specify whether file input is disabled. bool false labelDescription Specify the description text...
Read more >
Remember and Repopulate File Input - Stack Overflow
What I want to know how to do is after a user selects a file I will remember their choice and redisplay the...
Read more >
driveItem: createUploadSession - Microsoft Graph v1.0
This cleans up the temporary file holding the data previously uploaded. This should be used in scenarios where the upload is aborted, for ......
Read more >
FileUploader - Carbon Components Svelte
The FileUploader wraps FileUploaderButton and lists out uploaded files. ... It sets the status to "complete" ; by default, the status is "loading"...
Read more >
How to Troubleshoot Files Not Uploading - Kajabi Help Center
Log out and log back in. If you are experiencing issues or errors when attempting to upload your file to your site, begin...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found