@domql/state 2.3.132 → 2.3.137
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/dist/cjs/updateState.js +4 -2
- package/package.json +2 -2
- package/updateState.js +4 -3
package/dist/cjs/updateState.js
CHANGED
|
@@ -37,6 +37,7 @@ const STATE_UPDATE_OPTIONS = {
|
|
|
37
37
|
const updateState = function(obj, options = STATE_UPDATE_OPTIONS) {
|
|
38
38
|
const state = this;
|
|
39
39
|
const element = state.__element;
|
|
40
|
+
console.log(options);
|
|
40
41
|
if (!options.updateByState)
|
|
41
42
|
(0, import_utils.merge)(options, STATE_UPDATE_OPTIONS);
|
|
42
43
|
if (!state.__element)
|
|
@@ -101,7 +102,7 @@ const hoistStateUpdate = (state, obj, options) => {
|
|
|
101
102
|
preventUpdate: options.preventHoistElementUpdate,
|
|
102
103
|
overwrite: !options.replace
|
|
103
104
|
});
|
|
104
|
-
const hasNotUpdated =
|
|
105
|
+
const hasNotUpdated = options.preventUpdate !== true || !options.preventHoistElementUpdate;
|
|
105
106
|
if (!options.preventStateUpdateListener && hasNotUpdated) {
|
|
106
107
|
(0, import_event.triggerEventOnUpdate)("stateUpdated", obj, element, options);
|
|
107
108
|
}
|
|
@@ -117,7 +118,8 @@ const updateDependentState = (state, obj, options) => {
|
|
|
117
118
|
};
|
|
118
119
|
const applyElementUpdate = (state, obj, options) => {
|
|
119
120
|
const element = state.__element;
|
|
120
|
-
|
|
121
|
+
console.log("update", element.key);
|
|
122
|
+
if (options.preventUpdate !== true) {
|
|
121
123
|
element.update({}, {
|
|
122
124
|
...options,
|
|
123
125
|
updateByState: true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/state",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.137",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"@domql/report": "latest",
|
|
27
27
|
"@domql/utils": "latest"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "07ca3db13100667ebe3915db37a18b6e694a3ce3"
|
|
30
30
|
}
|
package/updateState.js
CHANGED
|
@@ -18,6 +18,7 @@ const STATE_UPDATE_OPTIONS = {
|
|
|
18
18
|
export const updateState = function (obj, options = STATE_UPDATE_OPTIONS) {
|
|
19
19
|
const state = this
|
|
20
20
|
const element = state.__element
|
|
21
|
+
console.log(options)
|
|
21
22
|
|
|
22
23
|
if (!options.updateByState) merge(options, STATE_UPDATE_OPTIONS)
|
|
23
24
|
|
|
@@ -32,7 +33,6 @@ export const updateState = function (obj, options = STATE_UPDATE_OPTIONS) {
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
applyOverwrite(state, obj, options)
|
|
35
|
-
|
|
36
36
|
const updateIsHoisted = hoistStateUpdate(state, obj, options)
|
|
37
37
|
if (updateIsHoisted) return state
|
|
38
38
|
|
|
@@ -90,7 +90,7 @@ const hoistStateUpdate = (state, obj, options) => {
|
|
|
90
90
|
preventUpdate: options.preventHoistElementUpdate,
|
|
91
91
|
overwrite: !options.replace
|
|
92
92
|
})
|
|
93
|
-
const hasNotUpdated =
|
|
93
|
+
const hasNotUpdated = options.preventUpdate !== true || !options.preventHoistElementUpdate
|
|
94
94
|
if (!options.preventStateUpdateListener && hasNotUpdated) {
|
|
95
95
|
triggerEventOnUpdate('stateUpdated', obj, element, options)
|
|
96
96
|
}
|
|
@@ -107,7 +107,8 @@ const updateDependentState = (state, obj, options) => {
|
|
|
107
107
|
|
|
108
108
|
const applyElementUpdate = (state, obj, options) => {
|
|
109
109
|
const element = state.__element
|
|
110
|
-
|
|
110
|
+
console.log('update', element.key)
|
|
111
|
+
if (options.preventUpdate !== true) {
|
|
111
112
|
element.update({}, {
|
|
112
113
|
...options,
|
|
113
114
|
updateByState: true
|