stream-chat 9.45.1 → 9.45.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4391,7 +4391,9 @@ function isErrorResponse(res) {
4391
4391
  // src/search/BaseSearchSource.ts
4392
4392
  var DEFAULT_SEARCH_SOURCE_OPTIONS = {
4393
4393
  debounceMs: 300,
4394
- pageSize: 10
4394
+ pageSize: 10,
4395
+ allowEmptySearchString: false,
4396
+ resetOnNewSearchQuery: true
4395
4397
  };
4396
4398
  var BaseSearchSourceBase = class {
4397
4399
  constructor(options) {
@@ -4406,10 +4408,15 @@ var BaseSearchSourceBase = class {
4406
4408
  this.canExecuteQuery = (newSearchString) => {
4407
4409
  const hasNewSearchQuery = typeof newSearchString !== "undefined";
4408
4410
  const searchString = newSearchString ?? this.searchQuery;
4409
- return !!(this.isActive && !this.isLoading && (this.hasNext || hasNewSearchQuery) && searchString);
4411
+ return !!(this.isActive && !this.isLoading && (this.hasNext || hasNewSearchQuery) && (this.allowEmptySearchString || searchString));
4412
+ };
4413
+ const { pageSize, allowEmptySearchString, resetOnNewSearchQuery } = {
4414
+ ...DEFAULT_SEARCH_SOURCE_OPTIONS,
4415
+ ...options
4410
4416
  };
4411
- const { pageSize } = { ...DEFAULT_SEARCH_SOURCE_OPTIONS, ...options };
4412
4417
  this.pageSize = pageSize;
4418
+ this.allowEmptySearchString = allowEmptySearchString;
4419
+ this.resetOnNewSearchQuery = resetOnNewSearchQuery;
4413
4420
  this.state = new StateStore(this.initialState);
4414
4421
  }
4415
4422
  get lastQueryError() {
@@ -4452,10 +4459,14 @@ var BaseSearchSourceBase = class {
4452
4459
  return this.state.getLatestValue().searchQuery;
4453
4460
  }
4454
4461
  getStateBeforeFirstQuery(newSearchString) {
4462
+ const initialState = this.initialState;
4463
+ const oldItems = this.items;
4464
+ const items = this.resetOnNewSearchQuery ? initialState.items : oldItems;
4455
4465
  return {
4456
- ...this.initialState,
4466
+ ...initialState,
4467
+ items,
4457
4468
  isActive: this.isActive,
4458
- isLoading: true,
4469
+ isLoading: this.resetOnNewSearchQuery ? true : !oldItems,
4459
4470
  searchQuery: newSearchString
4460
4471
  };
4461
4472
  }
@@ -16601,7 +16612,7 @@ var StreamChat = class _StreamChat {
16601
16612
  if (this.userAgent) {
16602
16613
  return this.userAgent;
16603
16614
  }
16604
- const version = "9.45.1";
16615
+ const version = "9.45.2";
16605
16616
  const clientBundle = "node-cjs";
16606
16617
  let userAgentString = "";
16607
16618
  if (this.sdkIdentifier) {