@statezero/core 0.1.84 → 0.1.85
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.
|
@@ -37,7 +37,6 @@ function relatedQuerysets(queryset) {
|
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
39
|
* Process an operation in the model store
|
|
40
|
-
* Only processes if the model store doesn't already have the operation.
|
|
41
40
|
*
|
|
42
41
|
* @param {Operation} operation - The operation to process
|
|
43
42
|
* @param {string} actionType - The action to perform ('add', 'update', 'confirm', 'reject')
|
|
@@ -47,10 +46,6 @@ function processModelStore(operation, actionType) {
|
|
|
47
46
|
const modelStore = modelStoreRegistry.getStore(ModelClass);
|
|
48
47
|
if (!modelStore)
|
|
49
48
|
return;
|
|
50
|
-
// Skip if the model store already has this operation
|
|
51
|
-
if (modelStore.operationsMap.has(operation.operationId)) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
49
|
switch (actionType) {
|
|
55
50
|
case 'add':
|
|
56
51
|
modelStore.addOperation(operation);
|
|
@@ -118,12 +113,7 @@ function processQuerysetStores(operation, actionType) {
|
|
|
118
113
|
querysetStoreMap = relatedQuerysets(queryset);
|
|
119
114
|
break;
|
|
120
115
|
}
|
|
121
|
-
|
|
122
|
-
const storesToRoute = Array.from(querysetStoreMap.values()).filter(store => {
|
|
123
|
-
return !store.operationsMap.has(operation.operationId);
|
|
124
|
-
});
|
|
125
|
-
// Route only to stores that don't have the operation yet
|
|
126
|
-
storesToRoute.forEach(applyAction);
|
|
116
|
+
Array.from(querysetStoreMap.values()).forEach(applyAction);
|
|
127
117
|
}
|
|
128
118
|
/**
|
|
129
119
|
* Process an operation in the metric stores based on operation type
|
package/dist/syncEngine/sync.js
CHANGED
|
@@ -46,19 +46,7 @@ export class SyncManager {
|
|
|
46
46
|
this.processMetrics(payload);
|
|
47
47
|
}
|
|
48
48
|
if (isLocalOperation) {
|
|
49
|
-
|
|
50
|
-
const modelStore = modelStoreRegistry.getStore(payload.modelClass);
|
|
51
|
-
const querysetStores = querysetStoreRegistry.getAllStoresForModel(payload.modelClass);
|
|
52
|
-
// If model store and all queryset stores already have the operation, skip
|
|
53
|
-
// Note: getStore() always returns a store (creates if needed)
|
|
54
|
-
// and operationsMap is always initialized in constructors
|
|
55
|
-
const modelStoreHasIt = modelStore.operationsMap.has(payload.operation_id);
|
|
56
|
-
const allQuerysetStoresHaveIt = querysetStores.length === 0 ||
|
|
57
|
-
querysetStores.every(store => store.operationsMap.has(payload.operation_id));
|
|
58
|
-
if (modelStoreHasIt && allQuerysetStoresHaveIt) {
|
|
59
|
-
return; // All stores already have it, no need to process
|
|
60
|
-
}
|
|
61
|
-
// Otherwise, continue to process for stores that don't have it yet
|
|
49
|
+
return;
|
|
62
50
|
}
|
|
63
51
|
// Add to batch for queryset/model processing
|
|
64
52
|
const key = `${event.model}::${event.configKey}`;
|
package/package.json
CHANGED