@domql/state 3.6.3 → 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.
@@ -28,8 +28,7 @@ const STATE_UPDATE_OPTIONS = {
28
28
  overwrite: true,
29
29
  preventHoistElementUpdate: false,
30
30
  updateByState: true,
31
- isHoisted: true,
32
- execStateFunction: true
31
+ isHoisted: true
33
32
  };
34
33
  const updateState = function(obj, options = STATE_UPDATE_OPTIONS) {
35
34
  const state = this;
@@ -76,15 +75,15 @@ const hoistStateUpdate = (state, obj, options) => {
76
75
  const passedValue = isStringState ? state.value : obj;
77
76
  const findRootState = (0, import_utils.getRootStateInKey)(stateKey, parent.state);
78
77
  const findGrandParentState = (0, import_utils.getParentStateInKey)(stateKey, parent.state);
79
- const changesValue = (0, import_utils.createNestedObjectByKeyPath)(stateKey, passedValue);
78
+ const cleanKey = stateKey.replaceAll("~/", "").replaceAll("../", "");
79
+ const changesValue = (0, import_utils.createNestedObjectByKeyPath)(cleanKey, passedValue);
80
80
  const targetParent = findRootState || findGrandParentState || parent.state;
81
81
  if (options.replace) (0, import_utils.overwriteDeep)(targetParent, changesValue || value);
82
82
  targetParent.update(changesValue, {
83
- execStateFunction: false,
83
+ ...options,
84
84
  isHoisted: true,
85
85
  preventUpdate: options.preventHoistElementUpdate,
86
- overwrite: !options.replace,
87
- ...options
86
+ overwrite: !options.replace
88
87
  });
89
88
  const hasNotUpdated = options.preventUpdate !== true || !options.preventHoistElementUpdate;
90
89
  if (!options.preventStateUpdateListener && hasNotUpdated) {
@@ -14,8 +14,7 @@ const STATE_UPDATE_OPTIONS = {
14
14
  overwrite: true,
15
15
  preventHoistElementUpdate: false,
16
16
  updateByState: true,
17
- isHoisted: true,
18
- execStateFunction: true
17
+ isHoisted: true
19
18
  };
20
19
  const updateState = function(obj, options = STATE_UPDATE_OPTIONS) {
21
20
  const state = this;
@@ -62,15 +61,15 @@ const hoistStateUpdate = (state, obj, options) => {
62
61
  const passedValue = isStringState ? state.value : obj;
63
62
  const findRootState = getRootStateInKey(stateKey, parent.state);
64
63
  const findGrandParentState = getParentStateInKey(stateKey, parent.state);
65
- const changesValue = createNestedObjectByKeyPath(stateKey, passedValue);
64
+ const cleanKey = stateKey.replaceAll("~/", "").replaceAll("../", "");
65
+ const changesValue = createNestedObjectByKeyPath(cleanKey, passedValue);
66
66
  const targetParent = findRootState || findGrandParentState || parent.state;
67
67
  if (options.replace) overwriteDeep(targetParent, changesValue || value);
68
68
  targetParent.update(changesValue, {
69
- execStateFunction: false,
69
+ ...options,
70
70
  isHoisted: true,
71
71
  preventUpdate: options.preventHoistElementUpdate,
72
- overwrite: !options.replace,
73
- ...options
72
+ overwrite: !options.replace
74
73
  });
75
74
  const hasNotUpdated = options.preventUpdate !== true || !options.preventHoistElementUpdate;
76
75
  if (!options.preventStateUpdateListener && hasNotUpdated) {