@cocreate/elements 1.34.3 → 1.34.4

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.4](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.34.3...v1.34.4) (2024-02-19)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * minor bug fixes ([b136dda](https://github.com/CoCreate-app/CoCreate-elements/commit/b136dda0543ca1e3e558e38384fb4b447c455e05))
7
+
1
8
  ## [1.34.3](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.34.2...v1.34.3) (2024-02-18)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/elements",
3
- "version": "1.34.3",
3
+ "version": "1.34.4",
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
@@ -85,6 +85,8 @@ async function initElement(el) {
85
85
 
86
86
  let data = getObject(el);
87
87
  if (!data || !data.type) return
88
+ if (data.object !== '' && data.object !== 'pending' && !(/^[0-9a-fA-F]{24}$/.test(data.object)))
89
+ return
88
90
 
89
91
  if (!elements.has(el)) {
90
92
  elements.set(el, '')
@@ -202,8 +204,11 @@ function initDataKey(element, data) {
202
204
  async function read(element, data, dataKey) {
203
205
  if (!dataKey)
204
206
  dataKey = { string: elements.get(element) }
205
- if (!data)
206
- data = { ...keys.get(dataKey).dataKey.object }
207
+ if (!data) {
208
+ let existingData = keys.get(dataKey.string)
209
+ if (existingData && existingData.dataKey && existingData.dataKey.object)
210
+ data = { ...existingData.dataKey.object }
211
+ }
207
212
 
208
213
  if (!dataKey || !data.type)
209
214
  return