@inglorious/store 4.0.1 → 4.0.2

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/package.json +1 -1
  2. package/src/store.js +10 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inglorious/store",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "description": "A state manager inspired by Redux, but tailored for the specific needs of game development.",
5
5
  "author": "IceOnFire <antony.mistretta@gmail.com> (https://ingloriouscoderz.it)",
6
6
  "license": "MIT",
package/src/store.js CHANGED
@@ -67,7 +67,15 @@ export function createStore({
67
67
  function update() {
68
68
  const processedEvents = []
69
69
 
70
- state = create(state, (draft) => {
70
+ state = create(state, patcher, {
71
+ enableAutoFreeze: state.entities.game?.devMode,
72
+ })
73
+
74
+ listeners.forEach((onUpdate) => onUpdate())
75
+
76
+ return processedEvents
77
+
78
+ function patcher(draft) {
71
79
  while (incomingEvents.length) {
72
80
  const event = incomingEvents.shift()
73
81
  processedEvents.push(event)
@@ -118,11 +126,7 @@ export function createStore({
118
126
  handle?.(draft, event.payload, api)
119
127
  })
120
128
  }
121
- })
122
-
123
- listeners.forEach((onUpdate) => onUpdate())
124
-
125
- return processedEvents
129
+ }
126
130
  }
127
131
 
128
132
  /**