@cocreate/elements 1.34.0 → 1.34.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
@@ -1,3 +1,10 @@
1
+ ## [1.34.1](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.34.0...v1.34.1) (2024-02-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * realtime defaults to false ([83d2787](https://github.com/CoCreate-app/CoCreate-elements/commit/83d2787da3e2d3386f379c692852d10f8b15f16e))
7
+
1
8
  # [1.34.0](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.33.2...v1.34.0) (2024-02-13)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/elements",
3
- "version": "1.34.0",
3
+ "version": "1.34.1",
4
4
  "description": "Fetch content into any html element by using html5 attributes to query data stored in CoCreate headless CMS. If data is changed it will instantly reflect in html tags as changes are broadcasted in realtime",
5
5
  "keywords": [
6
6
  "elements",
package/src/index.js CHANGED
@@ -94,7 +94,7 @@ async function initElement(el) {
94
94
  || el.contenteditable) {
95
95
  el.addEventListener('input', function (e) {
96
96
  const { object, key, isRealtime, isCrdt } = getAttributes(el);
97
- if (isRealtime == "false" || key == "_id") return;
97
+ if (!isRealtime || isRealtime === "false" || key === "_id") return;
98
98
  if (isCrdt == "true" && object && object !== 'pending') return
99
99
  if (e.detail && e.detail.skip == true) return;
100
100
  if (data.type !== 'object' && data[data.type] === 'pending') return
@@ -422,7 +422,7 @@ async function filterData(element, data, type, key) {
422
422
  await element.renderValue(data);
423
423
  } else if (key === '$length') {
424
424
  element.setValue(data[type].length);
425
- } else if (key.includes('$length')) {
425
+ } else if (key && key.includes('$length')) {
426
426
  let value = CRUD.getValueFromObject(data[type][0], key.replace(/\.\$length$/, ''))
427
427
  element.setValue(value.length);
428
428
  } else if (data)