@statezero/core 0.1.69 → 0.1.71

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.
@@ -128,8 +128,15 @@ export class ModelStore {
128
128
  return;
129
129
  }
130
130
  }
131
- item[pkField] = pk;
132
- nonTempPkItems.push(item);
131
+ if (item && typeof item.serialize === "function") {
132
+ const serializedItem = item.serialize();
133
+ serializedItem[pkField] = pk;
134
+ nonTempPkItems.push(serializedItem);
135
+ }
136
+ else {
137
+ item[pkField] = pk;
138
+ nonTempPkItems.push(item);
139
+ }
133
140
  });
134
141
  this.modelCache.set(this.cacheKey, nonTempPkItems);
135
142
  }
@@ -293,32 +293,7 @@ export class SyncManager {
293
293
  }
294
294
  }
295
295
  processModels(event) {
296
- const registry = this.registries.get(ModelStoreRegistry);
297
- if (!registry)
298
- return;
299
- // Get the model class for this event
300
- const modelClass = event.modelClass;
301
- if (!modelClass)
302
- return;
303
- // Get the model store for this model class
304
- const modelStore = registry.getStore(modelClass);
305
- if (!modelStore)
306
- return;
307
- // Event instances are just PKs - find which ones we have locally
308
- const eventPks = event.instances || [];
309
- // Get all currently rendered instances (includes ground truth + operations)
310
- const renderedInstances = modelStore.render();
311
- const localPks = new Set(renderedInstances.map((instance) => instance[modelClass.primaryKeyField]));
312
- const pksToSync = eventPks.filter((pk) => localPks.has(pk));
313
- if (pksToSync.length === 0) {
314
- console.log(`[SyncManager] No locally cached instances to sync for ${event.model}`);
315
- return;
316
- }
317
- // Sync only the PKs that are both in the event and locally cached
318
- console.log(`[SyncManager] Syncing ${pksToSync.length} model instances for ${event.model}`);
319
- modelStore.sync(pksToSync).catch((error) => {
320
- console.error(`[SyncManager] Failed to sync model store for ${event.model}:`, error);
321
- });
296
+ return;
322
297
  }
323
298
  }
324
299
  const syncManager = new SyncManager();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statezero/core",
3
- "version": "0.1.69",
3
+ "version": "0.1.71",
4
4
  "type": "module",
5
5
  "module": "ESNext",
6
6
  "description": "The type-safe frontend client for StateZero - connect directly to your backend models with zero boilerplate",