@statezero/core 0.1.3-9.2 → 0.1.3-9.3

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.
@@ -35,38 +35,6 @@ function relatedQuerysets(queryset) {
35
35
  });
36
36
  return result;
37
37
  }
38
- /**
39
- * Returns querysets that contain any of the specified instances
40
- * @param {Operation} operation - The operation containing instances to check
41
- * @returns {Map<QuerySet, Store>}
42
- */
43
- function querysetsContainingInstances(operation) {
44
- const ModelClass = operation.queryset.ModelClass;
45
- const pkField = ModelClass.primaryKeyField;
46
- const instancePks = new Set(operation.instances
47
- .filter(instance => instance && typeof instance === 'object' && pkField in instance)
48
- .map(instance => instance[pkField]));
49
- if (instancePks.size === 0) {
50
- return new Map();
51
- }
52
- const result = new Map();
53
- Array.from(querysetStoreRegistry._stores.entries()).forEach(([queryset, store]) => {
54
- if (store.modelClass !== ModelClass)
55
- return;
56
- try {
57
- // Check if this queryset contains any of the instances
58
- const renderedPks = new Set(store.render(false)); // Get without optimistic updates
59
- const hasIntersection = [...instancePks].some(pk => renderedPks.has(pk));
60
- if (hasIntersection) {
61
- result.set(store.queryset, store);
62
- }
63
- }
64
- catch (e) {
65
- console.warn('Error checking queryset for instances', e);
66
- }
67
- });
68
- return result;
69
- }
70
38
  /**
71
39
  * Process an operation in the model store
72
40
  *
@@ -133,12 +101,12 @@ function processQuerysetStores(operation, actionType) {
133
101
  case Type.UPDATE_INSTANCE:
134
102
  case Type.DELETE:
135
103
  case Type.DELETE_INSTANCE:
136
- // For updates and deletes, only route to querysets that actually contain the instances
137
- querysetStoreMap = querysetsContainingInstances(operation);
104
+ // No need to do anything, the model will change the queryset local filtering will handle it
105
+ querysetStoreMap = new Map();
138
106
  break;
139
107
  case Type.CHECKPOINT:
140
- // For checkpoints, route to querysets that contain the instances
141
- querysetStoreMap = querysetsContainingInstances(operation);
108
+ // No need to do anything, the model will change the queryset local filtering will handle it
109
+ querysetStoreMap = new Map();
142
110
  break;
143
111
  default:
144
112
  // For other operation types, use the existing related querysets logic
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statezero/core",
3
- "version": "0.1.39.2",
3
+ "version": "0.1.39.3",
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",