@schukai/monster 4.6.0 → 4.6.1

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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
 
4
4
 
5
+ ## [4.6.1] - 2025-05-15
6
+
7
+ ### Bug Fixes
8
+
9
+ - Improve lazy loading and error handling in select component
10
+
11
+
12
+
5
13
  ## [4.6.0] - 2025-05-15
6
14
 
7
15
  ### Add Features
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.7.0","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"4.6.0"}
1
+ {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.7.0","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"4.6.1"}
@@ -561,6 +561,8 @@ class Select extends CustomControl {
561
561
  let lazyLoadFlag = self.getOption("features.lazyLoad", false);
562
562
  const remoteFilterFlag = getFilterMode.call(this) === FILTER_MODE_REMOTE;
563
563
 
564
+ initTotal.call(self);
565
+
564
566
  if (getFilterMode.call(this) === FILTER_MODE_REMOTE) {
565
567
  self.setOption("features.lazyLoad", false);
566
568
  lazyLoadFlag = false;
@@ -585,16 +587,13 @@ class Select extends CustomControl {
585
587
  lookupSelection.call(self);
586
588
  } else {
587
589
  self.fetch().then(() => {
588
- setTotalText.call(self);
590
+
589
591
  }).catch((e) => {
590
592
  addErrorAttribute(self, e);
591
593
  });
592
594
  }
593
595
  }
594
596
 
595
- initTotal.call(self);
596
-
597
-
598
597
  setTimeout(() => {
599
598
  let lastValue = self.value;
600
599
  self[internalSymbol].attachObserver(
@@ -1408,9 +1407,9 @@ function fetchIt(url, controlOptions) {
1408
1407
 
1409
1408
  queueMicrotask(() => {
1410
1409
  checkOptionState.call(this);
1411
- setStatusOrRemoveBadges.call(this, "closed");
1412
- updatePopper.call(this);
1413
1410
  setTotalText.call(this);
1411
+ updatePopper.call(this);
1412
+ setStatusOrRemoveBadges.call(this, "closed");
1414
1413
 
1415
1414
  resolve(result);
1416
1415
  });
@@ -1714,6 +1713,9 @@ function getDefaultTranslation() {
1714
1713
  return translation;
1715
1714
  }
1716
1715
 
1716
+ /**
1717
+ * @private
1718
+ */
1717
1719
  function setTotalText() {
1718
1720
 
1719
1721
  if (getFilterMode.call(this) !== FILTER_MODE_REMOTE) {
@@ -2869,6 +2871,8 @@ function show() {
2869
2871
  return;
2870
2872
  }
2871
2873
 
2874
+ setTotalText.call(this);
2875
+
2872
2876
  focusFilter.call(this);
2873
2877
 
2874
2878
  const lazyLoadFlag =
@@ -2943,7 +2947,7 @@ function initDefaultOptionsFromUrl() {
2943
2947
  this[cleanupOptionsListSymbol] = false;
2944
2948
  importOptionsIntern.call(this, data);
2945
2949
  setStatusOrRemoveBadges.call(this, "open");
2946
- setTotal.call(this, data)
2950
+ initTotal.call(this, data)
2947
2951
  })
2948
2952
  .catch((e) => {
2949
2953
  addErrorAttribute(this, e);
@@ -2969,7 +2973,7 @@ function initTotal() {
2969
2973
 
2970
2974
  getGlobal().fetch(url).then((response) => {
2971
2975
  if (!response.ok) { // Improved status checking using `response.ok`
2972
- addErrorAttribute(this, `HTTP error! status: ${response.status} - ${response.statusText}`);
2976
+ addErrorAttribute(this, `HTTP error status: ${response.status} - ${response.statusText}`);
2973
2977
  return;
2974
2978
  }
2975
2979
 
@@ -3292,7 +3296,6 @@ function setStatusOrRemoveBadges(suggestion) {
3292
3296
  if (current !== suggestion) {
3293
3297
  this.setOption("classes.statusOrRemoveBadge", suggestion);
3294
3298
  }
3295
- return;
3296
3299
  }
3297
3300
  });
3298
3301
  }