stream-chat 9.45.0 → 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 +2 -2
- package/src/search/BaseSearchSource.ts +17 -4
- package/src/search/types.ts +4 -0
package/dist/esm/index.mjs
CHANGED
|
@@ -4205,7 +4205,9 @@ function isErrorResponse(res) {
|
|
|
4205
4205
|
// src/search/BaseSearchSource.ts
|
|
4206
4206
|
var DEFAULT_SEARCH_SOURCE_OPTIONS = {
|
|
4207
4207
|
debounceMs: 300,
|
|
4208
|
-
pageSize: 10
|
|
4208
|
+
pageSize: 10,
|
|
4209
|
+
allowEmptySearchString: false,
|
|
4210
|
+
resetOnNewSearchQuery: true
|
|
4209
4211
|
};
|
|
4210
4212
|
var BaseSearchSourceBase = class {
|
|
4211
4213
|
constructor(options) {
|
|
@@ -4220,10 +4222,15 @@ var BaseSearchSourceBase = class {
|
|
|
4220
4222
|
this.canExecuteQuery = (newSearchString) => {
|
|
4221
4223
|
const hasNewSearchQuery = typeof newSearchString !== "undefined";
|
|
4222
4224
|
const searchString = newSearchString ?? this.searchQuery;
|
|
4223
|
-
return !!(this.isActive && !this.isLoading && (this.hasNext || hasNewSearchQuery) && searchString);
|
|
4225
|
+
return !!(this.isActive && !this.isLoading && (this.hasNext || hasNewSearchQuery) && (this.allowEmptySearchString || searchString));
|
|
4226
|
+
};
|
|
4227
|
+
const { pageSize, allowEmptySearchString, resetOnNewSearchQuery } = {
|
|
4228
|
+
...DEFAULT_SEARCH_SOURCE_OPTIONS,
|
|
4229
|
+
...options
|
|
4224
4230
|
};
|
|
4225
|
-
const { pageSize } = { ...DEFAULT_SEARCH_SOURCE_OPTIONS, ...options };
|
|
4226
4231
|
this.pageSize = pageSize;
|
|
4232
|
+
this.allowEmptySearchString = allowEmptySearchString;
|
|
4233
|
+
this.resetOnNewSearchQuery = resetOnNewSearchQuery;
|
|
4227
4234
|
this.state = new StateStore(this.initialState);
|
|
4228
4235
|
}
|
|
4229
4236
|
get lastQueryError() {
|
|
@@ -4266,10 +4273,14 @@ var BaseSearchSourceBase = class {
|
|
|
4266
4273
|
return this.state.getLatestValue().searchQuery;
|
|
4267
4274
|
}
|
|
4268
4275
|
getStateBeforeFirstQuery(newSearchString) {
|
|
4276
|
+
const initialState = this.initialState;
|
|
4277
|
+
const oldItems = this.items;
|
|
4278
|
+
const items = this.resetOnNewSearchQuery ? initialState.items : oldItems;
|
|
4269
4279
|
return {
|
|
4270
|
-
...
|
|
4280
|
+
...initialState,
|
|
4281
|
+
items,
|
|
4271
4282
|
isActive: this.isActive,
|
|
4272
|
-
isLoading: true,
|
|
4283
|
+
isLoading: this.resetOnNewSearchQuery ? true : !oldItems,
|
|
4273
4284
|
searchQuery: newSearchString
|
|
4274
4285
|
};
|
|
4275
4286
|
}
|
|
@@ -16415,7 +16426,7 @@ var StreamChat = class _StreamChat {
|
|
|
16415
16426
|
if (this.userAgent) {
|
|
16416
16427
|
return this.userAgent;
|
|
16417
16428
|
}
|
|
16418
|
-
const version = "9.45.
|
|
16429
|
+
const version = "9.45.2";
|
|
16419
16430
|
const clientBundle = "browser-esm";
|
|
16420
16431
|
let userAgentString = "";
|
|
16421
16432
|
if (this.sdkIdentifier) {
|