@nice-code/state 0.4.8 → 0.4.10

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.
@@ -1510,8 +1510,8 @@ function ChangeList({
1510
1510
  children: groups.map((group) => /* @__PURE__ */ jsxDEV6(ChangeRow, {
1511
1511
  change: group.representative,
1512
1512
  count: group.count,
1513
- selected: group.representative.cuid === selectedCuid,
1514
- onClick: () => onSelect(group.representative.cuid),
1513
+ selected: group.oldest.cuid === selectedCuid,
1514
+ onClick: () => onSelect(group.oldest.cuid),
1515
1515
  showStore
1516
1516
  }, group.oldest.cuid, false, undefined, this))
1517
1517
  }, undefined, false, undefined, this);
@@ -2100,7 +2100,7 @@ function NiceStateDevtools_Panel({
2100
2100
  const selectedChange = useMemo(() => {
2101
2101
  if (selectedChangeCuid == null)
2102
2102
  return null;
2103
- const group = groups.find((g) => g.representative.cuid === selectedChangeCuid);
2103
+ const group = groups.find((g) => g.oldest.cuid === selectedChangeCuid);
2104
2104
  if (group == null)
2105
2105
  return changes.find((c) => c.cuid === selectedChangeCuid) ?? null;
2106
2106
  if (group.count > 1) {
@@ -2112,7 +2112,7 @@ function NiceStateDevtools_Panel({
2112
2112
  }
2113
2113
  return group.representative;
2114
2114
  }, [selectedChangeCuid, groups, changes]);
2115
- const latestCuid = filteredChanges.length > 0 ? filteredChanges[0].cuid : null;
2115
+ const latestCuid = groups.length > 0 ? groups[0].oldest.cuid : null;
2116
2116
  useEffect2(() => {
2117
2117
  if (stayOnLatest && latestCuid != null)
2118
2118
  setSelectedChangeCuid(latestCuid);
package/build/index.js CHANGED
@@ -77,6 +77,9 @@ class Store {
77
77
  this.currentState = initialState;
78
78
  }
79
79
  }
80
+ get state() {
81
+ return Object.freeze(this.currentState);
82
+ }
80
83
  _setInternalOptions({ ssr, reactionCreators = [] }) {
81
84
  this.ssr = ssr;
82
85
  this.reactionCreators = reactionCreators;
@@ -124,6 +124,9 @@ class Store {
124
124
  this.currentState = initialState;
125
125
  }
126
126
  }
127
+ get state() {
128
+ return Object.freeze(this.currentState);
129
+ }
127
130
  _setInternalOptions({ ssr, reactionCreators = [] }) {
128
131
  this.ssr = ssr;
129
132
  this.reactionCreators = reactionCreators;
@@ -55,6 +55,7 @@ export declare class Store<S extends object = object> {
55
55
  private reactions;
56
56
  private clientSubscriptions;
57
57
  constructor(initialState: S | (() => S));
58
+ get state(): S;
58
59
  /**
59
60
  * Returns the raw state object contained within this store at this moment.
60
61
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nice-code/state",
3
- "version": "0.4.8",
3
+ "version": "0.4.10",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {