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.
- package/dist/cjs/index.browser.js +17 -6
- package/dist/cjs/index.browser.js.map +2 -2
- package/dist/cjs/index.node.js +17 -6
- package/dist/cjs/index.node.js.map +2 -2
- package/dist/esm/index.mjs +17 -6
- package/dist/esm/index.mjs.map +2 -2
- package/dist/types/search/BaseSearchSource.d.ts +2 -0
- package/dist/types/search/types.d.ts +4 -0
- package/package.json +1 -1
- package/src/search/BaseSearchSource.ts +17 -4
- package/src/search/types.ts +4 -0
|
@@ -4418,7 +4418,9 @@ function isErrorResponse(res) {
|
|
|
4418
4418
|
// src/search/BaseSearchSource.ts
|
|
4419
4419
|
var DEFAULT_SEARCH_SOURCE_OPTIONS = {
|
|
4420
4420
|
debounceMs: 300,
|
|
4421
|
-
pageSize: 10
|
|
4421
|
+
pageSize: 10,
|
|
4422
|
+
allowEmptySearchString: false,
|
|
4423
|
+
resetOnNewSearchQuery: true
|
|
4422
4424
|
};
|
|
4423
4425
|
var BaseSearchSourceBase = class {
|
|
4424
4426
|
constructor(options) {
|
|
@@ -4433,10 +4435,15 @@ var BaseSearchSourceBase = class {
|
|
|
4433
4435
|
this.canExecuteQuery = (newSearchString) => {
|
|
4434
4436
|
const hasNewSearchQuery = typeof newSearchString !== "undefined";
|
|
4435
4437
|
const searchString = newSearchString ?? this.searchQuery;
|
|
4436
|
-
return !!(this.isActive && !this.isLoading && (this.hasNext || hasNewSearchQuery) && searchString);
|
|
4438
|
+
return !!(this.isActive && !this.isLoading && (this.hasNext || hasNewSearchQuery) && (this.allowEmptySearchString || searchString));
|
|
4439
|
+
};
|
|
4440
|
+
const { pageSize, allowEmptySearchString, resetOnNewSearchQuery } = {
|
|
4441
|
+
...DEFAULT_SEARCH_SOURCE_OPTIONS,
|
|
4442
|
+
...options
|
|
4437
4443
|
};
|
|
4438
|
-
const { pageSize } = { ...DEFAULT_SEARCH_SOURCE_OPTIONS, ...options };
|
|
4439
4444
|
this.pageSize = pageSize;
|
|
4445
|
+
this.allowEmptySearchString = allowEmptySearchString;
|
|
4446
|
+
this.resetOnNewSearchQuery = resetOnNewSearchQuery;
|
|
4440
4447
|
this.state = new StateStore(this.initialState);
|
|
4441
4448
|
}
|
|
4442
4449
|
get lastQueryError() {
|
|
@@ -4479,10 +4486,14 @@ var BaseSearchSourceBase = class {
|
|
|
4479
4486
|
return this.state.getLatestValue().searchQuery;
|
|
4480
4487
|
}
|
|
4481
4488
|
getStateBeforeFirstQuery(newSearchString) {
|
|
4489
|
+
const initialState = this.initialState;
|
|
4490
|
+
const oldItems = this.items;
|
|
4491
|
+
const items = this.resetOnNewSearchQuery ? initialState.items : oldItems;
|
|
4482
4492
|
return {
|
|
4483
|
-
...
|
|
4493
|
+
...initialState,
|
|
4494
|
+
items,
|
|
4484
4495
|
isActive: this.isActive,
|
|
4485
|
-
isLoading: true,
|
|
4496
|
+
isLoading: this.resetOnNewSearchQuery ? true : !oldItems,
|
|
4486
4497
|
searchQuery: newSearchString
|
|
4487
4498
|
};
|
|
4488
4499
|
}
|
|
@@ -16628,7 +16639,7 @@ var StreamChat = class _StreamChat {
|
|
|
16628
16639
|
if (this.userAgent) {
|
|
16629
16640
|
return this.userAgent;
|
|
16630
16641
|
}
|
|
16631
|
-
const version = "9.45.
|
|
16642
|
+
const version = "9.45.2";
|
|
16632
16643
|
const clientBundle = "browser-cjs";
|
|
16633
16644
|
let userAgentString = "";
|
|
16634
16645
|
if (this.sdkIdentifier) {
|