@uistate/core 5.1.1 → 5.2.0

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.
Files changed (2) hide show
  1. package/eventStateNew.js +8 -2
  2. package/package.json +1 -1
package/eventStateNew.js CHANGED
@@ -61,7 +61,13 @@ export function createEventState(initial = {}) {
61
61
  get(path) {
62
62
  if (destroyed) throw new Error('Cannot get from destroyed store');
63
63
  if (!path) return state;
64
- return path.split(".").reduce((obj, key) => obj?.[key], state);
64
+ const parts = path.split('.');
65
+ let cur = state;
66
+ for (const p of parts) {
67
+ if (cur == null) return undefined;
68
+ cur = cur[p];
69
+ }
70
+ return cur;
65
71
  },
66
72
 
67
73
  /**
@@ -140,7 +146,7 @@ export function createEventState(initial = {}) {
140
146
 
141
147
  if (destroyed) throw new Error('Cannot setAsync on destroyed store');
142
148
 
143
- this.set(path, data);
149
+ this.set(`${path}.data`, data);
144
150
  this.set(`${path}.status`, 'success');
145
151
  return data;
146
152
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uistate/core",
3
- "version": "5.1.1",
3
+ "version": "5.2.0",
4
4
  "description": "Lightweight event-driven state management with slot orchestration and experimental event-sequence testing (eventTest.js available under dual license)",
5
5
  "type": "module",
6
6
  "main": "index.js",