@abloatai/humans 0.37.0 → 0.37.1

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.
@@ -80,6 +80,23 @@ function isSameState(a, b) {
80
80
  }
81
81
  /** Deduplicate deltas to the same entity — keep meaningful state transitions only */
82
82
  export function deduplicateDeltas(ctx, deltas) {
83
+ // The dominant live-publication shape is a frame of independent entity
84
+ // creates. When every entity key occurs once, reconciliation cannot remove
85
+ // or reorder anything: preserve the already commit-ordered input directly
86
+ // and avoid allocating a bucket array, state signature, and two sorts per
87
+ // delta. The first duplicate falls through to the full transition logic.
88
+ const uniqueEntities = new Set();
89
+ let hasDuplicateEntity = false;
90
+ for (const delta of deltas) {
91
+ const key = `${delta.modelName}:${delta.modelId}`;
92
+ if (uniqueEntities.has(key)) {
93
+ hasDuplicateEntity = true;
94
+ break;
95
+ }
96
+ uniqueEntities.add(key);
97
+ }
98
+ if (!hasDuplicateEntity)
99
+ return deltas;
83
100
  const byEntity = new Map();
84
101
  for (const d of deltas) {
85
102
  const key = `${d.modelName}:${d.modelId}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abloatai/humans",
3
- "version": "0.37.0",
3
+ "version": "0.37.1",
4
4
  "description": "The optional human-facing local-state package for Ablo: presence, live queries, and React bindings.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -84,7 +84,7 @@
84
84
  "directory": "packages/humans"
85
85
  },
86
86
  "dependencies": {
87
- "@abloatai/transaction": "^0.37.0",
87
+ "@abloatai/transaction": "^0.37.1",
88
88
  "mobx": "^6.13.7",
89
89
  "uuid": "^11.1.0",
90
90
  "zod": "^4.4.3"
@@ -178,6 +178,23 @@ function isSameState(a: Record<string, unknown> | null, b: Record<string, unknow
178
178
 
179
179
  /** Deduplicate deltas to the same entity — keep meaningful state transitions only */
180
180
  export function deduplicateDeltas(ctx: DeltaPipelineContext, deltas: SyncDelta[]): SyncDelta[] {
181
+ // The dominant live-publication shape is a frame of independent entity
182
+ // creates. When every entity key occurs once, reconciliation cannot remove
183
+ // or reorder anything: preserve the already commit-ordered input directly
184
+ // and avoid allocating a bucket array, state signature, and two sorts per
185
+ // delta. The first duplicate falls through to the full transition logic.
186
+ const uniqueEntities = new Set<string>();
187
+ let hasDuplicateEntity = false;
188
+ for (const delta of deltas) {
189
+ const key = `${delta.modelName}:${delta.modelId}`;
190
+ if (uniqueEntities.has(key)) {
191
+ hasDuplicateEntity = true;
192
+ break;
193
+ }
194
+ uniqueEntities.add(key);
195
+ }
196
+ if (!hasDuplicateEntity) return deltas;
197
+
181
198
  const byEntity = new Map<string, SyncDelta[]>();
182
199
  for (const d of deltas) {
183
200
  const key = `${d.modelName}:${d.modelId}`;