pinia-orm-edge 1.9.0-28580890.9c8ee0d → 1.9.0-28580959.70a2cd0

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/dist/index.cjs CHANGED
@@ -1482,16 +1482,19 @@ class Query {
1482
1482
  */
1483
1483
  getHydratedModel(record, options) {
1484
1484
  const id = this.model.$getKey(record, true);
1485
- const savedHydratedModel = id && this.hydratedDataCache.get(this.model.$entity() + id);
1485
+ const savedHydratedModel = id && options?.operation !== "set" && this.hydratedDataCache.get(this.model.$entity() + id);
1486
1486
  if (!this.getNewHydrated && options?.operation !== "set" && savedHydratedModel) {
1487
- return savedHydratedModel.$fill(record, options);
1487
+ return savedHydratedModel;
1488
1488
  }
1489
1489
  const modelByType = this.model.$types()[record[this.model.$typeKey()]];
1490
1490
  const getNewInsance = (newOptions) => (modelByType ? modelByType.newRawInstance() : this.model).$newInstance(record, { relations: false, ...options || {}, ...newOptions });
1491
1491
  const hydratedModel = getNewInsance();
1492
- if (id && (!this.getNewHydrated && options?.operation !== "set" || options?.action === "update")) {
1492
+ if (id && !this.getNewHydrated && options?.operation !== "set") {
1493
1493
  this.hydratedDataCache.set(this.model.$entity() + id, hydratedModel);
1494
1494
  }
1495
+ if (id && options?.action === "update") {
1496
+ this.hydratedDataCache.set(this.model.$entity() + id, getNewInsance({ operation: "get" }));
1497
+ }
1495
1498
  return hydratedModel;
1496
1499
  }
1497
1500
  }
package/dist/index.mjs CHANGED
@@ -1480,16 +1480,19 @@ class Query {
1480
1480
  */
1481
1481
  getHydratedModel(record, options) {
1482
1482
  const id = this.model.$getKey(record, true);
1483
- const savedHydratedModel = id && this.hydratedDataCache.get(this.model.$entity() + id);
1483
+ const savedHydratedModel = id && options?.operation !== "set" && this.hydratedDataCache.get(this.model.$entity() + id);
1484
1484
  if (!this.getNewHydrated && options?.operation !== "set" && savedHydratedModel) {
1485
- return savedHydratedModel.$fill(record, options);
1485
+ return savedHydratedModel;
1486
1486
  }
1487
1487
  const modelByType = this.model.$types()[record[this.model.$typeKey()]];
1488
1488
  const getNewInsance = (newOptions) => (modelByType ? modelByType.newRawInstance() : this.model).$newInstance(record, { relations: false, ...options || {}, ...newOptions });
1489
1489
  const hydratedModel = getNewInsance();
1490
- if (id && (!this.getNewHydrated && options?.operation !== "set" || options?.action === "update")) {
1490
+ if (id && !this.getNewHydrated && options?.operation !== "set") {
1491
1491
  this.hydratedDataCache.set(this.model.$entity() + id, hydratedModel);
1492
1492
  }
1493
+ if (id && options?.action === "update") {
1494
+ this.hydratedDataCache.set(this.model.$entity() + id, getNewInsance({ operation: "get" }));
1495
+ }
1493
1496
  return hydratedModel;
1494
1497
  }
1495
1498
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinia-orm-edge",
3
- "version": "1.9.0-28580890.9c8ee0d",
3
+ "version": "1.9.0-28580959.70a2cd0",
4
4
  "description": "The Pinia plugin to enable Object-Relational Mapping access to the Pinia Store.",
5
5
  "keywords": [
6
6
  "vue",
@@ -46,7 +46,7 @@
46
46
  "pinia": "^2.1.7"
47
47
  },
48
48
  "dependencies": {
49
- "@pinia-orm/normalizr": "npm:@pinia-orm/normalizr-edge@1.9.0-28580890.9c8ee0d"
49
+ "@pinia-orm/normalizr": "npm:@pinia-orm/normalizr-edge@1.9.0-28580959.70a2cd0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@nuxt/eslint-config": "^0.3.10",