@domql/state 3.6.4 → 3.6.6
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 +5 -6
- package/dist/esm/updateState.js +5 -6
- package/dist/iife/index.js +755 -584
- package/package.json +3 -3
- package/updateState.js +6 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/state",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"prepublish": "npm run build && npm run copy:package:cjs"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@domql/report": "^3.6.
|
|
39
|
-
"@domql/utils": "^3.6.
|
|
38
|
+
"@domql/report": "^3.6.6",
|
|
39
|
+
"@domql/utils": "^3.6.6"
|
|
40
40
|
},
|
|
41
41
|
"gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
|
|
42
42
|
"browser": "./dist/esm/index.js",
|
package/updateState.js
CHANGED
|
@@ -17,8 +17,7 @@ const STATE_UPDATE_OPTIONS = {
|
|
|
17
17
|
overwrite: true,
|
|
18
18
|
preventHoistElementUpdate: false,
|
|
19
19
|
updateByState: true,
|
|
20
|
-
isHoisted: true
|
|
21
|
-
execStateFunction: true
|
|
20
|
+
isHoisted: true
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
export const updateState = function (obj, options = STATE_UPDATE_OPTIONS) {
|
|
@@ -82,15 +81,15 @@ export const hoistStateUpdate = (state, obj, options) => {
|
|
|
82
81
|
|
|
83
82
|
const findRootState = getRootStateInKey(stateKey, parent.state)
|
|
84
83
|
const findGrandParentState = getParentStateInKey(stateKey, parent.state)
|
|
85
|
-
const
|
|
84
|
+
const cleanKey = stateKey.replaceAll('~/', '').replaceAll('../', '')
|
|
85
|
+
const changesValue = createNestedObjectByKeyPath(cleanKey, passedValue)
|
|
86
86
|
const targetParent = findRootState || findGrandParentState || parent.state
|
|
87
|
-
if (options.replace) overwriteDeep(targetParent, changesValue || value)
|
|
87
|
+
if (options.replace) overwriteDeep(targetParent, changesValue || value)
|
|
88
88
|
targetParent.update(changesValue, {
|
|
89
|
-
|
|
89
|
+
...options,
|
|
90
90
|
isHoisted: true,
|
|
91
91
|
preventUpdate: options.preventHoistElementUpdate,
|
|
92
|
-
overwrite: !options.replace
|
|
93
|
-
...options
|
|
92
|
+
overwrite: !options.replace
|
|
94
93
|
})
|
|
95
94
|
const hasNotUpdated =
|
|
96
95
|
options.preventUpdate !== true || !options.preventHoistElementUpdate
|