selectic 3.0.20 → 3.0.22

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.
@@ -314,6 +314,11 @@ class SelecticStore {
314
314
  }, { deep: true });
315
315
  vue.watch(() => this.state.internalValue, () => {
316
316
  this.buildSelectedOptions();
317
+ /* If there is only one item, and the previous selected value was
318
+ * different, then if we change it to the only available item we
319
+ * should disable Selectic (user has no more choice).
320
+ * This is why it is needed to check autoDisabled here. */
321
+ this.checkAutoDisabled();
317
322
  }, { deep: true });
318
323
  vue.watch(() => this.state.allOptions, () => {
319
324
  this.checkAutoSelect();
@@ -1038,7 +1043,13 @@ class SelecticStore {
1038
1043
  /* Added options are the same as previous ones.
1039
1044
  * Stop fetching to avoid infinite loop
1040
1045
  */
1041
- errorMessage = labels.wrongQueryResult;
1046
+ if (!this.hasFetchedAllItems) {
1047
+ /* Display error if all items are not fetch
1048
+ * We can have the case where old value and result
1049
+ * are the same but total is correct when the
1050
+ * total is 0 */
1051
+ errorMessage = labels.wrongQueryResult;
1052
+ }
1042
1053
  setTimeout(() => this.buildAllOptions(true, true), 0);
1043
1054
  }
1044
1055
  else {
@@ -310,6 +310,11 @@ class SelecticStore {
310
310
  }, { deep: true });
311
311
  watch(() => this.state.internalValue, () => {
312
312
  this.buildSelectedOptions();
313
+ /* If there is only one item, and the previous selected value was
314
+ * different, then if we change it to the only available item we
315
+ * should disable Selectic (user has no more choice).
316
+ * This is why it is needed to check autoDisabled here. */
317
+ this.checkAutoDisabled();
313
318
  }, { deep: true });
314
319
  watch(() => this.state.allOptions, () => {
315
320
  this.checkAutoSelect();
@@ -1034,7 +1039,13 @@ class SelecticStore {
1034
1039
  /* Added options are the same as previous ones.
1035
1040
  * Stop fetching to avoid infinite loop
1036
1041
  */
1037
- errorMessage = labels.wrongQueryResult;
1042
+ if (!this.hasFetchedAllItems) {
1043
+ /* Display error if all items are not fetch
1044
+ * We can have the case where old value and result
1045
+ * are the same but total is correct when the
1046
+ * total is 0 */
1047
+ errorMessage = labels.wrongQueryResult;
1048
+ }
1038
1049
  setTimeout(() => this.buildAllOptions(true, true), 0);
1039
1050
  }
1040
1051
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "selectic",
3
- "version": "3.0.20",
3
+ "version": "3.0.22",
4
4
  "description": "Smart Select for VueJS 3.x",
5
5
  "main": "dist/selectic.common.js",
6
6
  "module": "dist/selectic.esm.js",
@@ -38,7 +38,7 @@
38
38
  "test": "npm run build && tape test/**/*.spec.js"
39
39
  },
40
40
  "dependencies": {
41
- "vtyx": "4.0.5"
41
+ "vtyx": "4.1.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@babel/types": "^7.21.2",
package/src/Store.tsx CHANGED
@@ -585,6 +585,11 @@ export default class SelecticStore {
585
585
 
586
586
  watch(() => this.state.internalValue, () => {
587
587
  this.buildSelectedOptions();
588
+ /* If there is only one item, and the previous selected value was
589
+ * different, then if we change it to the only available item we
590
+ * should disable Selectic (user has no more choice).
591
+ * This is why it is needed to check autoDisabled here. */
592
+ this.checkAutoDisabled();
588
593
  }, { deep: true });
589
594
 
590
595
  watch(() => this.state.allOptions, () => {
@@ -1447,7 +1452,13 @@ export default class SelecticStore {
1447
1452
  /* Added options are the same as previous ones.
1448
1453
  * Stop fetching to avoid infinite loop
1449
1454
  */
1450
- errorMessage = labels.wrongQueryResult;
1455
+ if (!this.hasFetchedAllItems) {
1456
+ /* Display error if all items are not fetch
1457
+ * We can have the case where old value and result
1458
+ * are the same but total is correct when the
1459
+ * total is 0 */
1460
+ errorMessage = labels.wrongQueryResult;
1461
+ }
1451
1462
  setTimeout(() => this.buildAllOptions(true, true), 0);
1452
1463
  } else {
1453
1464
  setTimeout(() => this.buildAllOptions(true), 0);