@appbaseio/reactivesearch-vue 1.35.2 → 1.35.4

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.
@@ -300,12 +300,23 @@ var DataSearch = {
300
300
  this.updateQueryHandler(this.componentId, this.$data.currentValue, this.$props);
301
301
  }
302
302
  },
303
+ isLoading: function isLoading(newVal) {
304
+ if (newVal) {
305
+ this.suggestions = [];
306
+ }
307
+ },
303
308
  suggestions: function suggestions(newVal) {
309
+ if (this.isLoading) {
310
+ this.normalizedSuggestions = [];
311
+ return;
312
+ }
304
313
  if (Array.isArray(newVal) && this.$data.currentValue.trim().length) {
305
314
  // shallow check allows us to set suggestions even if the next set
306
315
  // of suggestions are same as the current one
307
316
  this.$emit('suggestions', newVal);
308
- this.normalizedSuggestions = this.onSuggestions(newVal);
317
+ if (!isEqual(this.normalizedSuggestions, newVal)) {
318
+ this.normalizedSuggestions = this.onSuggestions(newVal);
319
+ }
309
320
  }
310
321
  },
311
322
  selectedValue: function selectedValue(newVal, oldVal) {
@@ -439,9 +450,7 @@ var DataSearch = {
439
450
  return;
440
451
  }
441
452
  // Refresh recent searches when value becomes empty
442
- if (!value && props.enableDefaultSuggestions === false) {
443
- _this.resetStoreForComponent(props.componentId);
444
- } else if (!value && _this.currentValue && _this.enableRecentSearches) {
453
+ if (props.enableDefaultSuggestions && !value && _this.currentValue && _this.enableRecentSearches) {
445
454
  _this.getRecentSearches();
446
455
  }
447
456
  if (isTagsMode) {
@@ -499,7 +508,7 @@ var DataSearch = {
499
508
  _this.$emit('suggestions', _this.suggestions);
500
509
  } else if (!value) {
501
510
  // reset suggestions
502
- _this.suggestions = [];
511
+ // this.suggestions = [];
503
512
  // invoke on suggestions
504
513
  _this.$emit('suggestions', _this.suggestions);
505
514
  }
@@ -510,11 +519,6 @@ var DataSearch = {
510
519
  if (props === void 0) {
511
520
  props = this.$props;
512
521
  }
513
- if (!value && props.enableDefaultSuggestions === false) {
514
- // clear Component data from store
515
- this.resetStoreForComponent(props.componentId);
516
- return;
517
- }
518
522
  var defaultQueryOptions;
519
523
  var query = DataSearch.defaultQuery(value, props);
520
524
  if (this.defaultQuery) {
@@ -2,6 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = "1.35.2";
5
+ var version = "1.35.4";
6
6
 
7
7
  exports.default = version;
@@ -293,12 +293,23 @@ var DataSearch = {
293
293
  this.updateQueryHandler(this.componentId, this.$data.currentValue, this.$props);
294
294
  }
295
295
  },
296
+ isLoading: function isLoading(newVal) {
297
+ if (newVal) {
298
+ this.suggestions = [];
299
+ }
300
+ },
296
301
  suggestions: function suggestions(newVal) {
302
+ if (this.isLoading) {
303
+ this.normalizedSuggestions = [];
304
+ return;
305
+ }
297
306
  if (Array.isArray(newVal) && this.$data.currentValue.trim().length) {
298
307
  // shallow check allows us to set suggestions even if the next set
299
308
  // of suggestions are same as the current one
300
309
  this.$emit('suggestions', newVal);
301
- this.normalizedSuggestions = this.onSuggestions(newVal);
310
+ if (!isEqual(this.normalizedSuggestions, newVal)) {
311
+ this.normalizedSuggestions = this.onSuggestions(newVal);
312
+ }
302
313
  }
303
314
  },
304
315
  selectedValue: function selectedValue(newVal, oldVal) {
@@ -432,9 +443,7 @@ var DataSearch = {
432
443
  return;
433
444
  }
434
445
  // Refresh recent searches when value becomes empty
435
- if (!value && props.enableDefaultSuggestions === false) {
436
- _this.resetStoreForComponent(props.componentId);
437
- } else if (!value && _this.currentValue && _this.enableRecentSearches) {
446
+ if (props.enableDefaultSuggestions && !value && _this.currentValue && _this.enableRecentSearches) {
438
447
  _this.getRecentSearches();
439
448
  }
440
449
  if (isTagsMode) {
@@ -492,7 +501,7 @@ var DataSearch = {
492
501
  _this.$emit('suggestions', _this.suggestions);
493
502
  } else if (!value) {
494
503
  // reset suggestions
495
- _this.suggestions = [];
504
+ // this.suggestions = [];
496
505
  // invoke on suggestions
497
506
  _this.$emit('suggestions', _this.suggestions);
498
507
  }
@@ -503,11 +512,6 @@ var DataSearch = {
503
512
  if (props === void 0) {
504
513
  props = this.$props;
505
514
  }
506
- if (!value && props.enableDefaultSuggestions === false) {
507
- // clear Component data from store
508
- this.resetStoreForComponent(props.componentId);
509
- return;
510
- }
511
515
  var defaultQueryOptions;
512
516
  var query = DataSearch.defaultQuery(value, props);
513
517
  if (this.defaultQuery) {
@@ -1,3 +1,3 @@
1
- var version = "1.35.2";
1
+ var version = "1.35.4";
2
2
 
3
3
  export default version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appbaseio/reactivesearch-vue",
3
- "version": "1.35.2",
3
+ "version": "1.35.4",
4
4
  "private": false,
5
5
  "main": "dist/cjs/index.js",
6
6
  "jsnext:main": "dist/es/index.js",