filestack / filestack-js

Official Javascript SDK for the Filestack API and content ingestion system.
https://www.filestack.com
MIT License
206 stars 76 forks source link

Custom source "unmounted" method not called #473

Open mcjlnrtwcz opened 2 years ago

mcjlnrtwcz commented 2 years ago

Expected Behavior

unmounted method of my custom source should be called when I close file picker

Current Behavior

unmounted method of my custom source is not called

Steps to Reproduce (for bugs)

  1. Create a simple custom source like
    const myNewCustomSource = {
    label: 'My new Custom Source',
    name: 'myCustomSource',
    icon: '<div />', // irrelevant for this example
    mounted: (element, actions) => {
        console.log("mounted")
    },
    unmounted: (element) => {
       console.log("unmounted")
    }
    }
  2. Import and push your custom source to fromSources array in filestack's options
  3. Open the file picker
  4. Select your new custom source
  5. Check console - your new source has been mounted
  6. Close file picker
  7. Check console - you won't see any info that it was unmounted

Context

I am trying to include custom source for filestack in a React app. I should be able to remove my components from the DOM when the user is done with picking the files from my custom source.

Your Environment

pavelmasek commented 2 years ago

Same here šŸ™‹ā€ā™‚ļø