@inglorious/store 12.6.2 → 12.8.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.
package/types/store.d.ts CHANGED
@@ -213,20 +213,18 @@ export type TypesConfig<
213
213
  export type UpdateMode = "auto" | "manual"
214
214
 
215
215
  /**
216
- * How the state is copied before queued events are applied.
216
+ * How an event's changes are copied.
217
217
  *
218
- * - `"structural-sharing"` (default) applies events to a draft proxy, so only the entities that
219
- * actually changed are copied. Unchanged entities keep their previous reference, which keeps
218
+ * - `"structural-sharing"` (default) applies each event to a draft proxy, so only the entities
219
+ * that actually changed are copied. Unchanged entities keep their previous reference, which keeps
220
220
  * reference-equality change detection cheap. Best for UI stores.
221
- * - `"copy-on-dispatch"` deep-copies each entity the first time it is handed to a handler or read by a
222
- * system, and applies events to the copy without a proxy. Entities nothing touches are not
221
+ * - `"copy-on-dispatch"` deep-copies each entity the first time an event hands it to a handler or a
222
+ * system, and applies the event to the copy without a proxy. Entities nothing touches are not
223
223
  * copied, and there is no per-entity proxy overhead, so it scales better when thousands of
224
224
  * entities change every frame, as in a game simulation.
225
225
  *
226
- * Under both strategies the current state is left intact while the queued events are applied to
227
- * a separate draft, and the two are swapped only once every event has been processed. This means
228
- * that during an update `api.getEntity()` and `api.getEntities()` read the previous state rather
229
- * than the in-flight changes.
226
+ * Under both strategies each event is a transaction: its handlers read, through the api, the state
227
+ * as the previous event left it, and the next event reads what they changed.
230
228
  */
231
229
  export type UpdateStrategy = "structural-sharing" | "copy-on-dispatch"
232
230
 
@@ -248,6 +246,8 @@ export interface StoreConfig<
248
246
  autoCreateEntities?: boolean
249
247
  updateMode?: UpdateMode
250
248
  updateStrategy?: UpdateStrategy
249
+ /** Freezes the state after each event under structural sharing, so a write outside a handler throws. */
250
+ devMode?: boolean
251
251
  }
252
252
 
253
253
  /**