Closed alihamuh closed 3 years ago
When I use getOptions with multiple like this:
const Search = () => ( <SelectSearch options={[]} getOptions={(query) => { return new Promise((resolve, reject) => { fetch( `https://www.thecocktaildb.com/api/json/v1/1/search.php?s=${query}` ) .then((response) => response.json()) .then(({ drinks }) => { resolve( drinks.map(({ idDrink, strDrink }) => ({ value: idDrink, name: strDrink, })) ); }) .catch(reject); }); }} multiple search closeOnSelect={false} placeholder="Your favorite drink" /> );
I get the error: TypeError: option is undefined0.chunk.js:33109:69 getOption http://localhost:3000/static/js/0.chunk.js:33109 find self-hosted:340 getOption http://localhost:3000/static/js/0.chunk.js:33109 map self-hosted:240 getOption http://localhost:3000/static/js/0.chunk.js:33109 option http://localhost:3000/static/js/0.chunk.js:33455 updateMemo http://localhost:3000/static/js/0.chunk.js:20785 useMemo http://localhost:3000/static/js/0.chunk.js:21236 useMemo http://localhost:3000/static/js/0.chunk.js:35130 useSelectSearch http://localhost:3000/static/js/0.chunk.js:33454 SelectSearch http://localhost:3000/static/js/0.chunk.js:32691 renderWithHooks http://localhost:3000/static/js/0.chunk.js:20140 updateForwardRef http://localhost:3000/static/js/0.chunk.js:22112 beginWork http://localhost:3000/static/js/0.chunk.js:23879 callCallback http://localhost:3000/static/js/0.chunk.js:5533 invokeGuardedCallbackDev http://localhost:3000/static/js/0.chunk.js:5582 invokeGuardedCallback http://localhost:3000/static/js/0.chunk.js:5635 beginWork$1 http://localhost:3000/static/js/0.chunk.js:28396 performUnitOfWork http://localhost:3000/static/js/0.chunk.js:27363 workLoopSync http://localhost:3000/static/js/0.chunk.js:27336 performSyncWorkOnRoot http://localhost:3000/static/js/0.chunk.js:26954 performSyncWorkOnRoot self-hosted:891 flushSyncCallbackQueueImpl http://localhost:3000/static/js/0.chunk.js:16474 unstable_runWithPriority http://localhost:3000/static/js/0.chunk.js:36555 runWithPriority$1 http://localhost:3000/static/js/0.chunk.js:16420 flushSyncCallbackQueueImpl http://localhost:3000/static/js/0.chunk.js:16469 flushSyncCallbackQueue http://localhost:3000/static/js/0.chunk.js:16457 discreteUpdates$1 http://localhost:3000/static/js/0.chunk.js:27093 discreteUpdates http://localhost:3000/static/js/0.chunk.js:6155 dispatchDiscreteEvent http://localhost:3000/static/js/0.chunk.js:9554 bind_applyFunctionN self-hosted:1042 dispatchDiscreteEvent self-hosted:1005
When I use getOptions with multiple like this:
I get the error: TypeError: option is undefined0.chunk.js:33109:69 getOption http://localhost:3000/static/js/0.chunk.js:33109 find self-hosted:340 getOption http://localhost:3000/static/js/0.chunk.js:33109 map self-hosted:240 getOption http://localhost:3000/static/js/0.chunk.js:33109 option http://localhost:3000/static/js/0.chunk.js:33455 updateMemo http://localhost:3000/static/js/0.chunk.js:20785 useMemo http://localhost:3000/static/js/0.chunk.js:21236 useMemo http://localhost:3000/static/js/0.chunk.js:35130 useSelectSearch http://localhost:3000/static/js/0.chunk.js:33454 SelectSearch http://localhost:3000/static/js/0.chunk.js:32691 renderWithHooks http://localhost:3000/static/js/0.chunk.js:20140 updateForwardRef http://localhost:3000/static/js/0.chunk.js:22112 beginWork http://localhost:3000/static/js/0.chunk.js:23879 callCallback http://localhost:3000/static/js/0.chunk.js:5533 invokeGuardedCallbackDev http://localhost:3000/static/js/0.chunk.js:5582 invokeGuardedCallback http://localhost:3000/static/js/0.chunk.js:5635 beginWork$1 http://localhost:3000/static/js/0.chunk.js:28396 performUnitOfWork http://localhost:3000/static/js/0.chunk.js:27363 workLoopSync http://localhost:3000/static/js/0.chunk.js:27336 performSyncWorkOnRoot http://localhost:3000/static/js/0.chunk.js:26954 performSyncWorkOnRoot self-hosted:891 flushSyncCallbackQueueImpl http://localhost:3000/static/js/0.chunk.js:16474 unstable_runWithPriority http://localhost:3000/static/js/0.chunk.js:36555 runWithPriority$1 http://localhost:3000/static/js/0.chunk.js:16420 flushSyncCallbackQueueImpl http://localhost:3000/static/js/0.chunk.js:16469 flushSyncCallbackQueue http://localhost:3000/static/js/0.chunk.js:16457 discreteUpdates$1 http://localhost:3000/static/js/0.chunk.js:27093 discreteUpdates http://localhost:3000/static/js/0.chunk.js:6155 dispatchDiscreteEvent http://localhost:3000/static/js/0.chunk.js:9554 bind_applyFunctionN self-hosted:1042 dispatchDiscreteEvent self-hosted:1005