@cocreate/elements 1.33.1 → 1.33.2

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,11 @@
1
+ ## [1.33.2](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.33.1...v1.33.2) (2024-01-30)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * !Data.object ([a793613](https://github.com/CoCreate-app/CoCreate-elements/commit/a7936131297f734e39f8a213c09133014f976a5e))
7
+ * data[type]replaced by sortedData if length > 0 ([ff399cb](https://github.com/CoCreate-app/CoCreate-elements/commit/ff399cb6e8ebb77a0a986ed7bc7fe67fc01c2a98))
8
+
1
9
  ## [1.33.1](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.33.0...v1.33.1) (2024-01-17)
2
10
 
3
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/elements",
3
- "version": "1.33.1",
3
+ "version": "1.33.2",
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
@@ -299,7 +299,7 @@ async function setData(element, data) {
299
299
 
300
300
  if (data.$filter && data.$filter.query) {
301
301
  let sortedData = sort$in(data[type], data.$filter.query)
302
- if (sortedData)
302
+ if (sortedData && sortedData.length)
303
303
  data[type] = sortedData
304
304
  }
305
305
 
@@ -336,7 +336,7 @@ async function setData(element, data) {
336
336
 
337
337
  }
338
338
 
339
- if (!data[type])
339
+ if (!data[type] || !data[type].length)
340
340
  continue;
341
341
 
342
342
  let action = el.getAttribute('actions')
@@ -642,6 +642,8 @@ async function getData(form) {
642
642
  if (Data.type === 'object') {
643
643
  if (typeof Data.object === 'string')
644
644
  Data.object = { _id: Data.object }
645
+ else if (!Data.object)
646
+ Data.object = {}
645
647
 
646
648
  if (Data.key)
647
649
  Data.object[Data.key] = value