@domql/state 2.5.52 → 2.5.53

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.
@@ -64,13 +64,15 @@ const applyOverwrite = (state, obj, options) => {
64
64
  const { overwrite } = options;
65
65
  if (!overwrite)
66
66
  return;
67
- const shallow = overwrite === "shallow";
67
+ const shallow = overwrite === "shallow" || overwrite === "shallow-once";
68
68
  const merge2 = overwrite === "merge";
69
69
  if (merge2) {
70
70
  (0, import_utils.deepMerge)(state, obj, import_ignore.IGNORE_STATE_PARAMS);
71
71
  return;
72
72
  }
73
73
  const overwriteFunc = shallow ? import_utils.overwriteShallow : import_utils.overwriteDeep;
74
+ if (options.overwrite === "shallow-once")
75
+ options.overwrite = true;
74
76
  overwriteFunc(state, obj, import_ignore.IGNORE_STATE_PARAMS);
75
77
  };
76
78
  const hoistStateUpdate = (state, obj, options) => {
@@ -96,9 +98,9 @@ const hoistStateUpdate = (state, obj, options) => {
96
98
  targetParent.update(changesValue, {
97
99
  execStateFunction: false,
98
100
  isHoisted: true,
99
- ...options,
100
101
  preventUpdate: options.preventHoistElementUpdate,
101
- overwrite: !options.replace
102
+ overwrite: !options.replace,
103
+ ...options
102
104
  });
103
105
  const hasNotUpdated = options.preventUpdate !== true || !options.preventHoistElementUpdate;
104
106
  if (!options.preventStateUpdateListener && hasNotUpdated) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/state",
3
- "version": "2.5.52",
3
+ "version": "2.5.53",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "dist/esm/index.js",
@@ -31,5 +31,5 @@
31
31
  "@domql/report": "latest",
32
32
  "@domql/utils": "latest"
33
33
  },
34
- "gitHead": "d417eb4852233ff71f790eae23b67b521e80c4f9"
34
+ "gitHead": "aafcffa2ebe3d9c2fb96bd3adcb05325b62e68ff"
35
35
  }
package/updateState.js CHANGED
@@ -49,7 +49,7 @@ const applyOverwrite = (state, obj, options) => {
49
49
  const { overwrite } = options
50
50
  if (!overwrite) return
51
51
 
52
- const shallow = overwrite === 'shallow'
52
+ const shallow = overwrite === 'shallow' || overwrite === 'shallow-once'
53
53
  const merge = overwrite === 'merge'
54
54
 
55
55
  if (merge) {
@@ -58,6 +58,7 @@ const applyOverwrite = (state, obj, options) => {
58
58
  }
59
59
 
60
60
  const overwriteFunc = shallow ? overwriteShallow : overwriteDeep
61
+ if (options.overwrite === 'shallow-once') options.overwrite = true
61
62
  overwriteFunc(state, obj, IGNORE_STATE_PARAMS)
62
63
  }
63
64
 
@@ -84,9 +85,9 @@ const hoistStateUpdate = (state, obj, options) => {
84
85
  targetParent.update(changesValue, {
85
86
  execStateFunction: false,
86
87
  isHoisted: true,
87
- ...options,
88
88
  preventUpdate: options.preventHoistElementUpdate,
89
- overwrite: !options.replace
89
+ overwrite: !options.replace,
90
+ ...options
90
91
  })
91
92
  const hasNotUpdated = options.preventUpdate !== true || !options.preventHoistElementUpdate
92
93
  if (!options.preventStateUpdateListener && hasNotUpdated) {