@signalium/query 1.0.17 → 1.0.18

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @signalium/query
2
2
 
3
+ ## 1.0.18
4
+
5
+ ### Patch Changes
6
+
7
+ - 395730a: Fix entity cache keys to include shapeKey, preventing stale entity validation errors after schema changes
8
+
3
9
  ## 1.0.17
4
10
 
5
11
  ### Patch Changes
@@ -1139,7 +1139,8 @@ class EntityStore {
1139
1139
  });
1140
1140
  }
1141
1141
  const warn = this.queryClient.getContext().log?.warn;
1142
- return createEntityProxy(record.key, record, shape, entityRelay, this.queryClient, warn);
1142
+ const desc = `${shape.typenameValue}:${id}`;
1143
+ return createEntityProxy(record.key, record, shape, entityRelay, this.queryClient, warn, desc);
1143
1144
  }
1144
1145
  }
1145
1146
  class NetworkManager {
@@ -1331,7 +1332,7 @@ function parseObjectEntities(obj, objectShape, queryClient, entityRefs) {
1331
1332
  throw new Error(`Entity id is required: ${typename}`);
1332
1333
  }
1333
1334
  const desc = `${typename}:${id}`;
1334
- const key = utils.hashValue(desc);
1335
+ const key = utils.hashValue([desc, entityDef.shapeKey]);
1335
1336
  if (entityRefs !== void 0) {
1336
1337
  entityRefs.add(key);
1337
1338
  }
@@ -2350,7 +2351,7 @@ class MutationResultImpl {
2350
2351
  const entityId = obj[idField];
2351
2352
  if (entityId !== void 0) {
2352
2353
  const typename = entityDef.typenameValue;
2353
- const entityKey = utils.hashValue(`${typename}:${entityId}`);
2354
+ const entityKey = utils.hashValue([`${typename}:${entityId}`, entityDef.shapeKey]);
2354
2355
  this.queryClient.registerOptimisticUpdate(entityKey, obj);
2355
2356
  this._pendingOptimisticKeys.add(entityKey);
2356
2357
  }