@@ -74,7 +74,7 @@ export abstract class BaseSearchSource<T> implements SearchSource<T> {
7474 protected pageSize : number ;
7575 abstract readonly type : SearchSourceType ;
7676 searchDebounced : DebouncedExecQueryFunction ;
77- // todo: hold filters, sort, options attributes and allow to change them
77+ private resolveDebouncedSearch ?: ( value ?: unknown ) => void ;
7878
7979 protected constructor ( options ?: SearchSourceOptions ) {
8080 const finalOptions = { ...DEFAULT_SEARCH_SOURCE_OPTIONS , ...options } ;
@@ -172,6 +172,7 @@ export abstract class BaseSearchSource<T> implements SearchSource<T> {
172172 isLoading : false ,
173173 items : [ ...( prev . items ?? [ ] ) , ...( stateUpdate . items || [ ] ) ] ,
174174 } ) ) ;
175+ this . resolveDebouncedSearch ?.( ) ;
175176 }
176177 }
177178
@@ -191,7 +192,10 @@ export abstract class BaseSearchSource<T> implements SearchSource<T> {
191192 this . state . partialNext ( { isLoading : true } ) ;
192193 }
193194
194- await this . searchDebounced ( searchQuery ) ;
195+ await new Promise ( ( resolve ) => {
196+ this . resolveDebouncedSearch = resolve ;
197+ this . searchDebounced ( searchQuery ) ;
198+ } ) ;
195199 }
196200
197201 resetState ( stateOverrides ?: Partial < SearchSourceState < T > > ) {
@@ -297,7 +301,7 @@ export class MessageSearchSource<
297301
298302 const messageFilters : MessageFilters < StreamChatGenerics > = {
299303 text : searchQuery ,
300- type : 'regular' , // todo : type: 'reply' resp. do not filter by type and allow to jump to a message in a thread
304+ type : 'regular' , // FIXME : type: 'reply' resp. do not filter by type and allow to jump to a message in a thread - missing support
301305 ...this . messageSearchFilters ,
302306 } as MessageFilters < StreamChatGenerics > ;
303307
0 commit comments