@cocreate/elements 1.7.4 → 1.7.5
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 +7 -0
- package/package.json +1 -1
- package/src/index.js +9 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [1.7.5](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.7.4...v1.7.5) (2022-06-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add element to map to reduce repetitive reads. ([8d4e2e9](https://github.com/CoCreate-app/CoCreate-elements/commit/8d4e2e9d1c2a544e2eef8b72fbfe97a62bd7452f))
|
|
7
|
+
|
|
1
8
|
## [1.7.4](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.7.3...v1.7.4) (2022-05-23)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/elements",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.5",
|
|
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
|
@@ -5,6 +5,7 @@ import { initSetValues, setValue } from './setValue';
|
|
|
5
5
|
import { initGetValues, getValue } from './getValue';
|
|
6
6
|
|
|
7
7
|
const selector = "[collection][document_id][name]:not(cocreate-select, link), input, textarea, select, [contenteditable]";
|
|
8
|
+
const initializing = new Map();
|
|
8
9
|
|
|
9
10
|
function init() {
|
|
10
11
|
let elements = document.querySelectorAll(selector);
|
|
@@ -19,9 +20,14 @@ function initElements(elements) {
|
|
|
19
20
|
if (doc) {
|
|
20
21
|
let collection = doc.collection;
|
|
21
22
|
let document_id = doc.document_id;
|
|
22
|
-
|
|
23
|
+
let initialize = initializing.get(element)
|
|
24
|
+
if (!initialize || initialize.collection != collection && initialize.document_id != document_id){
|
|
25
|
+
initializing.set(element, {collection, document_id});
|
|
26
|
+
documents.set(`${collection}${document_id}`, {collection, document_id});
|
|
27
|
+
}
|
|
23
28
|
}
|
|
24
29
|
}
|
|
30
|
+
|
|
25
31
|
read(documents, elements);
|
|
26
32
|
}
|
|
27
33
|
|
|
@@ -85,6 +91,8 @@ function setData(elements, data) {
|
|
|
85
91
|
|
|
86
92
|
isRendered = true;
|
|
87
93
|
}
|
|
94
|
+
initializing.delete(el)
|
|
95
|
+
|
|
88
96
|
});
|
|
89
97
|
|
|
90
98
|
if (isRendered) {
|