@@ -103,7 +103,7 @@ export const GraphQlSearchInput: React.FC<ISearchInputProps> = (props) => {
103103 [ LoadingMessage , initialPlaceholder , needShowLoadingMessage ] )
104104 const selectedValue = useMemo ( ( ) => needShowLoadingMessage ? [ ] : value ,
105105 [ value , needShowLoadingMessage ] )
106- const isDisabled = disabled || needShowLoadingMessage
106+ const isDisabled = disabled || needShowLoadingMessage || ! search
107107
108108 const notFoundContent = useMemo ( ( ) => isInitialLoading || isSearchLoading || isLoadingMore
109109 ? < Loader size = 'small' delay = { 0 } fill />
@@ -145,9 +145,10 @@ export const GraphQlSearchInput: React.FC<ISearchInputProps> = (props) => {
145145 const loadInitialOptions = useCallback ( async ( ) => {
146146 const values = initialValue || value
147147 if ( ! isEmpty ( values ) ) {
148- setInitialLoading ( true )
149148 const initialValueQuery = isFunction ( getInitialValueQuery ) ? getInitialValueQuery ( values ) : { id_in : values }
150149 const searchFn = isFunction ( initialValueSearch ) ? initialValueSearch : search
150+ if ( ! searchFn ) return
151+ setInitialLoading ( true )
151152 const initialOptions = await searchFn ( client , null , initialValueQuery , values . length )
152153 setInitialData ( prevData => uniqBy ( [ ...initialOptions , ...prevData ] , keyField ) )
153154 setInitialLoading ( false )
@@ -193,7 +194,7 @@ export const GraphQlSearchInput: React.FC<ISearchInputProps> = (props) => {
193194
194195 const searchMoreSuggestions = useCallback (
195196 async ( value , skip ) => {
196- if ( isAllDataLoaded ) return
197+ if ( ! search || isAllDataLoaded ) return
197198
198199 setLoadingMore ( true )
199200 const data = await search ( client , value , null , 10 , skip )
0 commit comments