Skip to content

Commit

Permalink
fix(bind): check for where function when binding
Browse files Browse the repository at this point in the history
Should correctly detect if the ref is a collection or a document

fix #146
  • Loading branch information
posva committed Nov 19, 2017
1 parent 0e926f6 commit 6c6ebd6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function bindDocument ({

function bind ({ vm, key, ref }) {
let unbind
if (ref.add) {
if (ref.where) {
unbind = bindCollection({
vm,
key,
Expand Down
3 changes: 3 additions & 0 deletions test/helpers/mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ class CollectionReference {
return this.data[id]
}

// used to check if it's a collection or document ref
where () {}

doc (id) {
id = id || new Key()
return this.data[id] = this.data[id] || new DocumentReference({
Expand Down

0 comments on commit 6c6ebd6

Please sign in to comment.