leoric 2.7.2 → 2.7.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.
package/History.md CHANGED
@@ -1,3 +1,12 @@
1
+ 2.7.3 / 2022-08-25
2
+ ==================
3
+
4
+ ## What's Changed
5
+ * fix: should skip loading models that is loaded before by @cyjake in https://github.com/cyjake/leoric/pull/335
6
+
7
+
8
+ **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.7.2...v2.7.3
9
+
1
10
  2.7.2 / 2022-08-24
2
11
  ==================
3
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leoric",
3
- "version": "2.7.2",
3
+ "version": "2.7.3",
4
4
  "description": "JavaScript Object-relational mapping alchemy",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
package/src/realm.js CHANGED
@@ -83,7 +83,6 @@ async function loadModels(Spine, models, opts) {
83
83
  const columns = schemaInfo[model.physicTable] || schemaInfo[model.table];
84
84
  if (!model.attributes) initAttributes(model, columns);
85
85
  model.load(columns);
86
- Spine.models[model.name] = model;
87
86
  }
88
87
 
89
88
  for (const model of models) {
@@ -158,8 +157,9 @@ class Realm {
158
157
  models = Object.values(this.models);
159
158
  }
160
159
 
160
+ for (const model of models) this.Bone.models[model.name] = model;
161
161
  // models could be connected already if cached
162
- models = models.filter(model => !model.synchronized);
162
+ models = models.filter(model => model.synchronized == null);
163
163
 
164
164
  if (models.length > 0) {
165
165
  await loadModels(this.Bone, models, this.options);