@domql/state 2.31.37 → 2.32.1

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.
@@ -54,7 +54,8 @@ const updateState = async function(obj, options = STATE_UPDATE_OPTIONS) {
54
54
  const updateIsHoisted = await hoistStateUpdate(state, obj, options);
55
55
  if (updateIsHoisted) return state;
56
56
  await updateDependentState(state, obj, options);
57
- await applyElementUpdate(state, obj, options);
57
+ const updated = await applyElementUpdate(state, obj, options);
58
+ if (updated === false) return false;
58
59
  if (!options.preventStateUpdateListener) {
59
60
  await (0, import_event.triggerEventOnUpdate)("stateUpdate", obj, element, options);
60
61
  }
@@ -115,7 +116,7 @@ const updateDependentState = async (state, obj, options) => {
115
116
  const applyElementUpdate = async (state, obj, options) => {
116
117
  const element = state.__element;
117
118
  if (options.preventUpdate !== true) {
118
- await element.update(
119
+ return await element.update(
119
120
  {},
120
121
  {
121
122
  ...options,
@@ -123,7 +124,7 @@ const applyElementUpdate = async (state, obj, options) => {
123
124
  }
124
125
  );
125
126
  } else if (options.preventUpdate === "recursive") {
126
- await element.update(
127
+ return await element.update(
127
128
  {},
128
129
  {
129
130
  ...options,
@@ -56,7 +56,8 @@ const updateState = async function(obj, options = STATE_UPDATE_OPTIONS) {
56
56
  const updateIsHoisted = await hoistStateUpdate(state, obj, options);
57
57
  if (updateIsHoisted) return state;
58
58
  await updateDependentState(state, obj, options);
59
- await applyElementUpdate(state, obj, options);
59
+ const updated = await applyElementUpdate(state, obj, options);
60
+ if (updated === false) return false;
60
61
  if (!options.preventStateUpdateListener) {
61
62
  await triggerEventOnUpdate("stateUpdate", obj, element, options);
62
63
  }
@@ -116,14 +117,14 @@ const updateDependentState = async (state, obj, options) => {
116
117
  const applyElementUpdate = async (state, obj, options) => {
117
118
  const element = state.__element;
118
119
  if (options.preventUpdate !== true) {
119
- await element.update(
120
+ return await element.update(
120
121
  {},
121
122
  __spreadProps(__spreadValues({}, options), {
122
123
  updateByState: true
123
124
  })
124
125
  );
125
126
  } else if (options.preventUpdate === "recursive") {
126
- await element.update(
127
+ return await element.update(
127
128
  {},
128
129
  __spreadProps(__spreadValues({}, options), {
129
130
  isHoisted: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/state",
3
- "version": "2.31.37",
3
+ "version": "2.32.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "index.js",
@@ -28,9 +28,9 @@
28
28
  "prepublish": "npx rimraf -I dist && npm run build && npm run copy:package:cjs"
29
29
  },
30
30
  "dependencies": {
31
- "@domql/event": "^2.31.37",
32
- "@domql/report": "^2.31.37",
33
- "@domql/utils": "^2.31.37"
31
+ "@domql/event": "^2.32.1",
32
+ "@domql/report": "^2.32.1",
33
+ "@domql/utils": "^2.32.1"
34
34
  },
35
- "gitHead": "4a0a9c683f742b8d81fe3c8c4022939b93058971"
35
+ "gitHead": "dacd7cc0abd5d46a1be9c04dc99d6f266521970f"
36
36
  }
package/updateState.js CHANGED
@@ -51,7 +51,8 @@ export const updateState = async function (
51
51
 
52
52
  await updateDependentState(state, obj, options)
53
53
 
54
- await applyElementUpdate(state, obj, options)
54
+ const updated = await applyElementUpdate(state, obj, options)
55
+ if (updated === false) return false
55
56
 
56
57
  if (!options.preventStateUpdateListener) {
57
58
  await triggerEventOnUpdate('stateUpdate', obj, element, options)
@@ -128,7 +129,7 @@ const updateDependentState = async (state, obj, options) => {
128
129
  const applyElementUpdate = async (state, obj, options) => {
129
130
  const element = state.__element
130
131
  if (options.preventUpdate !== true) {
131
- await element.update(
132
+ return await element.update(
132
133
  {},
133
134
  {
134
135
  ...options,
@@ -136,7 +137,7 @@ const applyElementUpdate = async (state, obj, options) => {
136
137
  }
137
138
  )
138
139
  } else if (options.preventUpdate === 'recursive') {
139
- await element.update(
140
+ return await element.update(
140
141
  {},
141
142
  {
142
143
  ...options,