hunk.code_window:       this.state = {
           defaultOptions: Array.isArray(props.defaultOptions)
             ? props.defaultOptions
             : undefined,
           inputValue: props.inputValue,
           isLoading: props.defaultOptions === true ? true : false,
           loadedOptions: [],
           passEmptyOptions: false,
         };
  
hunk.labels: keep keep keep keep replace keep keep keep keep
hunk.after_edit:         inputValue: typeof props.inputValue !== 'undefined' ? props.inputValue : '',
  
hunk.file_path: src/Async.js
hunk.type: replace
file: import React, { Component } from 'react';
  
  import AsyncSelect from '../../src/Async';
  import { colourOptions } from '../data';
  
  type State = {
    inputValue: string,
  };
  
  const filterColors = (inputValue: string) => {
    if (inputValue) {
      return colourOptions.filter(i =>
          i.label.toLowerCase().includes(inputValue.toLowerCase())
        );
    }
    return colourOptions;
  };
  
  const promiseOptions = inputValue =>
    new Promise(resolve => {
      setTimeout(() => {
        resolve(filterColors(inputValue));
      }, 1000);
    });
  
  export default class WithPromises extends Component<*, State> {
    state = { inputValue: '' };
    handleInputChange = (newValue: string) => {
      const inputValue = newValue.replace(/\W/g, '');
      this.setState({ inputValue });
      return inputValue;
    };
    render() {
      return (
        <AsyncSelect cacheOptions defaultOptions={colourOptions} loadOptions={promiseOptions} />
      );
    }
  }
  