@livequery/client 1.0.32 → 1.0.33

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.
@@ -67,7 +67,7 @@ class CollectionObservable extends rxjs_1.Observable {
67
67
  this.document_id = this.is_collection_ref ? null : refs[refs.length - 1];
68
68
  }
69
69
  sync(stream) {
70
- var _a, _b, _c, _d, _e, _f;
70
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
71
71
  const realtime = (_a = this.collection_options.realtime) !== null && _a !== void 0 ? _a : true;
72
72
  const actions = { update: false, reindex: false };
73
73
  for (const { data, error } of stream) {
@@ -132,7 +132,7 @@ class CollectionObservable extends rxjs_1.Observable {
132
132
  if (index >= 0 && realtime) {
133
133
  if (type == 'added' || type == 'modified') {
134
134
  actions.update = true;
135
- if (Object.keys(payload).some(key => ['created_at', this.collection_options.filters._order_by].includes(key))) {
135
+ if (Object.keys(payload).some(key => { var _a, _b; return ['created_at', (_b = (_a = this.collection_options) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b._order_by].includes(key); })) {
136
136
  actions.reindex = true;
137
137
  }
138
138
  __classPrivateFieldGet(this, _CollectionObservable_state, "f").items[index] = Object.assign(Object.assign(Object.assign({}, __classPrivateFieldGet(this, _CollectionObservable_state, "f").items[index]), payload), { __adding: false, __updating: false, __removing: false });
@@ -149,8 +149,11 @@ class CollectionObservable extends rxjs_1.Observable {
149
149
  }
150
150
  }
151
151
  }
152
- actions.reindex && __classPrivateFieldGet(this, _CollectionObservable_state, "f").items.sort((0, get_sort_function_1.get_sort_function)(__classPrivateFieldGet(this, _CollectionObservable_state, "f").items[0], this.collection_options.filters._order_by || 'created_at', this.collection_options.filters._sort));
153
- actions.reindex && (__classPrivateFieldGet(this, _CollectionObservable_IdMap, "f").clear(), __classPrivateFieldGet(this, _CollectionObservable_state, "f").items.map((item, index) => __classPrivateFieldGet(this, _CollectionObservable_IdMap, "f").set(item.id, index)));
152
+ if (actions.reindex) {
153
+ __classPrivateFieldGet(this, _CollectionObservable_state, "f").items = __classPrivateFieldGet(this, _CollectionObservable_state, "f").items.sort((0, get_sort_function_1.get_sort_function)(__classPrivateFieldGet(this, _CollectionObservable_state, "f").items[0], ((_h = (_g = this.collection_options) === null || _g === void 0 ? void 0 : _g.filters) === null || _h === void 0 ? void 0 : _h._order_by) || 'created_at', (_k = (_j = this.collection_options) === null || _j === void 0 ? void 0 : _j.filters) === null || _k === void 0 ? void 0 : _k._sort));
154
+ __classPrivateFieldGet(this, _CollectionObservable_IdMap, "f").clear();
155
+ __classPrivateFieldGet(this, _CollectionObservable_state, "f").items.map((item, index) => __classPrivateFieldGet(this, _CollectionObservable_IdMap, "f").set(item.id, index));
156
+ }
154
157
  actions.update && __classPrivateFieldGet(this, _CollectionObservable_$state, "f").next(__classPrivateFieldGet(this, _CollectionObservable_state, "f"));
155
158
  }
156
159
  fetch_data(options = {}, flush = false) {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "repository": {
4
4
  "url": "https://github.com/livequery/client"
5
5
  },
6
- "version": "1.0.32",
6
+ "version": "1.0.33",
7
7
  "description": "",
8
8
  "main": "build/index.js",
9
9
  "types": "build/index.d.ts",