@livequery/client 1.0.49 → 1.0.50

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.
@@ -162,17 +162,20 @@ class CollectionObservable extends rxjs_1.Observable {
162
162
  actions.update && __classPrivateFieldGet(this, _CollectionObservable_$state, "f").next(__classPrivateFieldGet(this, _CollectionObservable_state, "f"));
163
163
  }
164
164
  fetch_data(options = {}, flush = false) {
165
- if (!this.ref || __classPrivateFieldGet(this, _CollectionObservable_state, "f").loading)
165
+ if (__classPrivateFieldGet(this, _CollectionObservable_refs, "f").length == 0)
166
166
  return;
167
167
  if (flush) {
168
168
  __classPrivateFieldSet(this, _CollectionObservable_next_cursor, {}, "f");
169
169
  __classPrivateFieldGet(this, _CollectionObservable_subscriptions, "f").forEach(s => s.unsubscribe());
170
170
  __classPrivateFieldGet(this, _CollectionObservable_subscriptions, "f").clear();
171
+ __classPrivateFieldGet(this, _CollectionObservable_IdMap, "f").clear();
171
172
  }
172
- flush && __classPrivateFieldGet(this, _CollectionObservable_IdMap, "f").clear();
173
+ const has_more_data_refs = __classPrivateFieldGet(this, _CollectionObservable_refs, "f").filter(ref => __classPrivateFieldGet(this, _CollectionObservable_next_cursor, "f")[ref] === undefined || (__classPrivateFieldGet(this, _CollectionObservable_next_cursor, "f")[ref] && __classPrivateFieldGet(this, _CollectionObservable_next_cursor, "f")[ref] != '#'));
174
+ // Load more but no more data || loading
175
+ if (!flush && (has_more_data_refs.length == 0 || __classPrivateFieldGet(this, _CollectionObservable_state, "f").loading))
176
+ return;
173
177
  __classPrivateFieldSet(this, _CollectionObservable_state, Object.assign(Object.assign({}, __classPrivateFieldGet(this, _CollectionObservable_state, "f")), { items: flush ? [] : __classPrivateFieldGet(this, _CollectionObservable_state, "f").items, error: null, loading: true, options }), "f");
174
178
  __classPrivateFieldGet(this, _CollectionObservable_$state, "f").next(__classPrivateFieldGet(this, _CollectionObservable_state, "f"));
175
- const has_more_data_refs = __classPrivateFieldGet(this, _CollectionObservable_refs, "f").filter(ref => __classPrivateFieldGet(this, _CollectionObservable_next_cursor, "f")[ref] === undefined || (__classPrivateFieldGet(this, _CollectionObservable_next_cursor, "f")[ref] && __classPrivateFieldGet(this, _CollectionObservable_next_cursor, "f")[ref] != '#'));
176
179
  const queries = has_more_data_refs.map(ref => (this
177
180
  .collection_options
178
181
  .transporter
@@ -276,6 +279,8 @@ class CollectionObservable extends rxjs_1.Observable {
276
279
  }
277
280
  exports.CollectionObservable = CollectionObservable;
278
281
  _CollectionObservable_$state = new WeakMap(), _CollectionObservable_subscriptions = new WeakMap(), _CollectionObservable_state = new WeakMap(), _CollectionObservable_next_cursor = new WeakMap(), _CollectionObservable_IdMap = new WeakMap(), _CollectionObservable_refs = new WeakMap(), _CollectionObservable_instances = new WeakSet(), _CollectionObservable_ref_parser = function _CollectionObservable_ref_parser(path) {
282
+ if (!path)
283
+ return [];
279
284
  const refs_builder = (paths) => {
280
285
  const [a, b, ...c] = paths;
281
286
  if (!b)
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.49",
6
+ "version": "1.0.50",
7
7
  "description": "",
8
8
  "main": "build/index.js",
9
9
  "types": "build/index.d.ts",