@statezero/core 0.2.30 → 0.2.31
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.
|
@@ -212,6 +212,7 @@ export class QuerysetStoreRegistry {
|
|
|
212
212
|
if (this._tempStores.has(queryset)) {
|
|
213
213
|
store = this._tempStores.get(queryset);
|
|
214
214
|
store.isTemp = false; // Promote to permanent store
|
|
215
|
+
store.registerWithModelStore(); // Register for model store changes now that it's permanent
|
|
215
216
|
this._stores.set(semanticKey, store);
|
|
216
217
|
this.syncManager.followModel(this, queryset.ModelClass);
|
|
217
218
|
}
|
|
@@ -219,6 +220,7 @@ export class QuerysetStoreRegistry {
|
|
|
219
220
|
else if (!this._stores.has(semanticKey)) {
|
|
220
221
|
store = this.getStore(queryset);
|
|
221
222
|
store.isTemp = false;
|
|
223
|
+
store.registerWithModelStore(); // Register for model store changes now that it's permanent
|
|
222
224
|
this._stores.set(semanticKey, store);
|
|
223
225
|
this.syncManager.followModel(this, queryset.ModelClass);
|
|
224
226
|
}
|
|
@@ -250,12 +252,14 @@ export class QuerysetStoreRegistry {
|
|
|
250
252
|
if (this._tempStores.has(queryset)) {
|
|
251
253
|
store = this._tempStores.get(queryset);
|
|
252
254
|
store.isTemp = false; // Promote to permanent store
|
|
255
|
+
store.registerWithModelStore(); // Register for model store changes now that it's permanent
|
|
253
256
|
this._stores.set(semanticKey, store);
|
|
254
257
|
}
|
|
255
258
|
else {
|
|
256
259
|
// Create a new permanent store
|
|
257
260
|
store = this.getStore(queryset);
|
|
258
261
|
store.isTemp = false;
|
|
262
|
+
store.registerWithModelStore(); // Register for model store changes now that it's permanent
|
|
259
263
|
this._stores.set(semanticKey, store);
|
|
260
264
|
}
|
|
261
265
|
}
|
|
@@ -32,6 +32,11 @@ export class QuerysetStore {
|
|
|
32
32
|
getInflightOperations(): any[];
|
|
33
33
|
prune(): void;
|
|
34
34
|
registerRenderCallback(callback: any): () => boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Register this store with the model store for change notifications.
|
|
37
|
+
* Called when a temp store is promoted to permanent.
|
|
38
|
+
*/
|
|
39
|
+
registerWithModelStore(): void;
|
|
35
40
|
/**
|
|
36
41
|
* Helper to validate PKs against the model store and apply local filtering/sorting.
|
|
37
42
|
* This is the core of the rendering logic.
|
|
@@ -31,10 +31,14 @@ export class QuerysetStore {
|
|
|
31
31
|
this._lastRenderedPks = null;
|
|
32
32
|
this.renderCallbacks = new Set();
|
|
33
33
|
// Register for model store changes to re-render when model data changes
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
// Only register permanent stores - temp stores are transient and should not
|
|
35
|
+
// accumulate callbacks (causes reactivity cascade when Vue creates new querysets)
|
|
36
|
+
if (!this.isTemp) {
|
|
37
|
+
const modelStore = modelStoreRegistry.getStore(this.modelClass);
|
|
38
|
+
this._modelStoreUnregister = modelStore.registerRenderCallback(() => {
|
|
39
|
+
this._emitRenderEvent();
|
|
40
|
+
});
|
|
41
|
+
}
|
|
38
42
|
}
|
|
39
43
|
// Caching
|
|
40
44
|
get cacheKey() {
|
|
@@ -150,6 +154,18 @@ export class QuerysetStore {
|
|
|
150
154
|
this.renderCallbacks.add(callback);
|
|
151
155
|
return () => this.renderCallbacks.delete(callback);
|
|
152
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Register this store with the model store for change notifications.
|
|
159
|
+
* Called when a temp store is promoted to permanent.
|
|
160
|
+
*/
|
|
161
|
+
registerWithModelStore() {
|
|
162
|
+
if (this._modelStoreUnregister)
|
|
163
|
+
return; // Already registered
|
|
164
|
+
const modelStore = modelStoreRegistry.getStore(this.modelClass);
|
|
165
|
+
this._modelStoreUnregister = modelStore.registerRenderCallback(() => {
|
|
166
|
+
this._emitRenderEvent();
|
|
167
|
+
});
|
|
168
|
+
}
|
|
153
169
|
/**
|
|
154
170
|
* Helper to validate PKs against the model store and apply local filtering/sorting.
|
|
155
171
|
* This is the core of the rendering logic.
|
package/package.json
CHANGED