@schukai/monster 4.143.5 → 4.143.6

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/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"Volker Schukai","dependencies":{"@floating-ui/dom":"^1.7.6"},"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.143.5"}
1
+ {"author":"Volker Schukai","dependencies":{"@floating-ui/dom":"^1.7.6"},"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.143.6"}
@@ -155,6 +155,18 @@ const debounceSizeSymbol = Symbol("debounceSize");
155
155
  */
156
156
  const hashChangeSymbol = Symbol("hashChange");
157
157
 
158
+ /**
159
+ * @private
160
+ * @type {symbol}
161
+ */
162
+ const pendingConfigWriteSymbol = Symbol("pendingConfigWrite");
163
+
164
+ /**
165
+ * @private
166
+ * @type {symbol}
167
+ */
168
+ const configWritePromiseSymbol = Symbol("configWritePromise");
169
+
158
170
  /**
159
171
  * The Filter component is used to show and handle the filter values.
160
172
  *
@@ -1637,12 +1649,51 @@ function updateConfig() {
1637
1649
  if (!(host && hasConfigIdentity.call(this))) {
1638
1650
  return;
1639
1651
  }
1652
+
1640
1653
  const configKey = getFilterConfigKey.call(this);
1654
+ this[pendingConfigWriteSymbol] = {
1655
+ key: configKey,
1656
+ value: this[settingsSymbol].getOptions(),
1657
+ };
1658
+
1659
+ if (this[configWritePromiseSymbol]) {
1660
+ return;
1661
+ }
1662
+
1663
+ writePendingConfig.call(this, host);
1664
+ }
1665
+
1666
+ /**
1667
+ * @private
1668
+ * @param {Host} host
1669
+ */
1670
+ function writePendingConfig(host) {
1671
+ const pending = this[pendingConfigWriteSymbol];
1672
+ delete this[pendingConfigWriteSymbol];
1673
+
1674
+ if (!pending) {
1675
+ return;
1676
+ }
1641
1677
 
1642
1678
  try {
1643
- host.setConfig(configKey, this[settingsSymbol].getOptions());
1679
+ this[configWritePromiseSymbol] = Promise.resolve(
1680
+ host.setConfig(pending.key, pending.value),
1681
+ )
1682
+ .catch((error) => {
1683
+ addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, error?.message || error);
1684
+ })
1685
+ .finally(() => {
1686
+ delete this[configWritePromiseSymbol];
1687
+ if (this[pendingConfigWriteSymbol]) {
1688
+ writePendingConfig.call(this, host);
1689
+ }
1690
+ });
1644
1691
  } catch (error) {
1692
+ delete this[configWritePromiseSymbol];
1645
1693
  addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, error?.message || error);
1694
+ if (this[pendingConfigWriteSymbol]) {
1695
+ writePendingConfig.call(this, host);
1696
+ }
1646
1697
  }
1647
1698
  }
1648
1699