@miso.ai/server-wordpress 0.6.3-beta.12 → 0.6.3-beta.13

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/package.json CHANGED
@@ -17,9 +17,9 @@
17
17
  "simonpai <simon.pai@askmiso.com>"
18
18
  ],
19
19
  "dependencies": {
20
- "@miso.ai/server-commons": "0.6.3-beta.12",
20
+ "@miso.ai/server-commons": "0.6.3-beta.13",
21
21
  "axios": "^1.6.2",
22
22
  "axios-retry": "^3.3.1"
23
23
  },
24
- "version": "0.6.3-beta.12"
24
+ "version": "0.6.3-beta.13"
25
25
  }
@@ -50,7 +50,7 @@ export default class EntityIndex {
50
50
  if (this.hierarchical) {
51
51
  return; // already all fetched
52
52
  }
53
- ids = asArray(ids);
53
+ ids = asArray(ids).filter(id => id); // discard 0, null, undefined
54
54
 
55
55
  const promises = []
56
56
  const idsToFetch = [];
@@ -85,8 +85,11 @@ export default class EntityIndex {
85
85
  }
86
86
 
87
87
  _resolveFetch(id) {
88
- this._fetching.get(id).resolve();
89
- this._fetching.delete(id);
88
+ const res = this._fetching.get(id);
89
+ if (res) {
90
+ res.resolve();
91
+ this._fetching.delete(id);
92
+ }
90
93
  }
91
94
 
92
95
  async get(id) {
@@ -96,13 +99,14 @@ export default class EntityIndex {
96
99
  }
97
100
 
98
101
  async getAll(ids) {
102
+ ids = ids.filter(id => id); // discard 0, null, undefined
99
103
  await this._dataReady();
100
104
  await this.fetch(ids);
101
105
  return ids.map(id => this._index.get(id));
102
106
  }
103
107
 
104
108
  async getValue(id) {
105
- if (id === undefined) {
109
+ if (!id) { // 0, null, undefined
106
110
  return undefined;
107
111
  }
108
112
  return this._value(await this.get(id));
package/src/version.js CHANGED
@@ -1 +1 @@
1
- export default '0.6.3-beta.12';
1
+ export default '0.6.3-beta.13';