beestate 0.1.13 → 0.1.14

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.
@@ -1,6 +1,7 @@
1
1
  export { type InstanceKey } from './types/InstanceKey.tsx';
2
2
  export { type Locked } from './types/Locked.tsx';
3
3
  export { type Patch } from './types/Patch.tsx';
4
+ export { type Prefill } from './types/Prefill.tsx';
4
5
  export { type RequestState } from './types/RequestState.tsx';
5
6
  export { type RequestAbortedState } from './types/RequestState/RequestAbortedState.tsx';
6
7
  export { type RequestFulfilledState } from './types/RequestState/RequestFulfilledState.tsx';
@@ -1,6 +1,6 @@
1
1
  import type { Locked } from './Locked.tsx';
2
2
  import type { LockedOverride } from './LockedOverride.tsx';
3
3
  import type { StoreState } from './StoreState.tsx';
4
- export type Patch<TStoreState extends StoreState = StoreState> = {
4
+ export type Patch<TStoreState extends StoreState = StoreState> = null | {
5
5
  [TKey in keyof TStoreState]?: undefined | (TStoreState[TKey] extends Locked<infer TValue> ? LockedOverride<TValue> : TStoreState[TKey]);
6
6
  };
@@ -150,7 +150,7 @@ class InternalStore {
150
150
  return instanceKey in this.stateAll;
151
151
  };
152
152
  this.patchState = (instanceKey, reducer, payload, prevState) => {
153
- const patch = reducer(prevState, payload);
153
+ const patch = reducer(prevState, payload) ?? {};
154
154
  const updatedLockedStateNames = [];
155
155
  const wrappedStateNames = [];
156
156
  let nextState = prevState;
@@ -148,7 +148,7 @@ class InternalStore {
148
148
  return instanceKey in this.stateAll;
149
149
  };
150
150
  this.patchState = (instanceKey, reducer, payload, prevState) => {
151
- const patch = reducer(prevState, payload);
151
+ const patch = reducer(prevState, payload) ?? {};
152
152
  const updatedLockedStateNames = [];
153
153
  const wrappedStateNames = [];
154
154
  let nextState = prevState;
package/package.json CHANGED
@@ -20,5 +20,5 @@
20
20
  "prepublishOnly": "npm run build"
21
21
  },
22
22
  "types": "dist/@types",
23
- "version": "0.1.13"
23
+ "version": "0.1.14"
24
24
  }