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

Picker throws validation errors when only customSource is passed to `fromSources` #528

Open pigpudle opened 11 months ago

pigpudle commented 11 months ago

Hi! I'm trying to create a picker with only custom source, I use this guide: https://www.filestack.com/docs/tutorials/picker-custom-source/

This guide works fine & correctly only if I have any other sources passed before custom source in fromSources array:

For example 1) These options work fine:

const options = {
    fromSources: [ 'local_file_system', myNewCustomSource ] // <-- this one works fine, but if I change it to `[ myNewCustomSource, 'local_file_system' ]` it stops working
    maxFiles: 20,
    uploadInBackground: false,
    onUploadDone: (res) => console.log(res),
};

2) These options don't work:

const options = {
    fromSources: [ myNewCustomSource ] // <-- only one single custom source fails
    maxFiles: 20,
    uploadInBackground: false,
    onUploadDone: (res) => console.log(res),
};

The 2nd example throws validation errors like:

Here is the codesandbox with the bug: https://codesandbox.io/s/dawn-darkness-vd9yv5?file=/src/index.js:4808-4814

Expected Behavior

Single custom source should work without validation errors

Current Behavior

The 2nd example throws validation errors like:

Possible Solution

Steps to Reproduce (for bugs)

Described above Here is the codesandbox with the bug: https://codesandbox.io/s/dawn-darkness-vd9yv5?file=/src/index.js:4808-4814

Additional Screenshots

image

image

Context

Your Environment