Skip to content

Commit

Permalink
Merge pull request #103 from DxCx/cursor-non-black-empty
Browse files Browse the repository at this point in the history
fix: return empty array when find yield no results
  • Loading branch information
dotansimha authored Sep 13, 2017
2 parents ad59ccd + b09c6af commit bb3bffc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions dist/ObservableCursor.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/ObservableCursor.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions dist/bundles/index.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ var ObservableCursor = (function (_super) {
if (_this._isDataInitinialized) {
observer.next(_this._data);
}
else if (cursor.count() === 0) {
_this._isDataInitinialized = true;
observer.next(_this._data);
}
_this._observers.push(observer);
if (!_this._hCursor) {
_this._hCursor = _this._observeCursor(cursor);
Expand Down
3 changes: 3 additions & 0 deletions src/ObservableCursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ export class ObservableCursor<T> extends Observable<T[]> {
super((observer: Subscriber<T[]>) => {
if (this._isDataInitinialized) {
observer.next(this._data);
} else if ( cursor.count() === 0 ) {
this._isDataInitinialized = true;
observer.next(this._data);
}

this._observers.push(observer);
Expand Down

0 comments on commit bb3bffc

Please sign in to comment.