@statezero/core 0.1.21 → 0.1.23

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.
@@ -134,7 +134,7 @@ export class QuerysetStore {
134
134
  let result;
135
135
  if (this.getRootStore && typeof this.getRootStore === "function" && !this.isTemp) {
136
136
  const { isRoot, rootStore } = this.getRootStore(this.queryset);
137
- if (!isRoot && rootStore) {
137
+ if (!isRoot && rootStore && rootStore.lastSync) {
138
138
  result = this.renderFromRoot(optimistic, rootStore);
139
139
  }
140
140
  }
@@ -203,7 +203,7 @@ export class QuerysetStore {
203
203
  // Check if we're delegating to a root store
204
204
  if (this.getRootStore && typeof this.getRootStore === "function" && !this.isTemp) {
205
205
  const { isRoot, rootStore } = this.getRootStore(this.queryset);
206
- if (!isRoot && rootStore) {
206
+ if (!isRoot && rootStore && rootStore.lastSync) {
207
207
  // We're delegating to a root store - don't sync, just mark as needing sync
208
208
  console.log(`[${id}] Delegating to root store, marking sync needed.`);
209
209
  this.needsSync = true;
@@ -221,6 +221,9 @@ export class QuerysetStore {
221
221
  modelClass: this.modelClass,
222
222
  });
223
223
  const { data, included } = response;
224
+ if (isNil(data)) {
225
+ return;
226
+ }
224
227
  console.log(`[${id}] Sync fetch completed. Received: ${JSON.stringify(data)}.`);
225
228
  // Persists all the instances (including nested instances) to the model store
226
229
  processIncludedEntities(modelStoreRegistry, included, this.modelClass);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statezero/core",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
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",