Skip to content

Commit ad2618f

Browse files
authored
Merge pull request #39 from assemblethis/assemblethis-patch-1
Remove inconsequential calls to fetchSession() and problematic calls to login
2 parents 0b5c57a + 8dd3e0a commit ad2618f

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pouch-vue",
3-
"version": "0.3.4",
3+
"version": "0.3.5",
44
"description": "PouchDB bindings for Vue.js",
55
"main": "lib/index.js",
66
"types": "types/index.d.ts",

src/index.js

-9
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,6 @@ import { isRemote } from 'pouchdb-utils';
402402
});
403403
});
404404

405-
fetchSession(databases[remoteDB]);
406-
407405
return sync;
408406
},
409407
push(localDB, remoteDB=defaultDB, options = {}) {
@@ -480,8 +478,6 @@ import { isRemote } from 'pouchdb-utils';
480478
});
481479
});
482480

483-
fetchSession(databases[remoteDB]);
484-
485481
return rep;
486482
},
487483

@@ -559,8 +555,6 @@ import { isRemote } from 'pouchdb-utils';
559555
});
560556
});
561557

562-
fetchSession(databases[remoteDB]);
563-
564558
return rep;
565559
},
566560

@@ -605,8 +599,6 @@ import { isRemote } from 'pouchdb-utils';
605599
});
606600
});
607601

608-
fetchSession(databases[db]);
609-
610602
return changes;
611603
},
612604

@@ -805,7 +797,6 @@ import { isRemote } from 'pouchdb-utils';
805797
} else if (typeof databaseParam === 'string') {
806798
if (!databases[databaseParam]) {
807799
makeInstance(databaseParam);
808-
login(databases[databaseParam]);
809800
}
810801
db = databases[databaseParam];
811802
}

tests/testData.spec.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ describe('Set selector to null', () => {
208208
// trip up the watcher on the pouch database config options
209209
let selector = function () { return (this.age < this.maxAge) ? null : {} }
210210

211-
function testFunc() {
211+
function testFunc(done) {
212212
const localVue = createLocalVue()
213213

214214
// add requisite PouchDB plugins
@@ -232,7 +232,13 @@ describe('Set selector to null', () => {
232232
wrapper.vm.todos = ['north', 'east', 'south', 'west'];
233233

234234
wrapper.vm.maxAge = 50;
235-
expect(wrapper.emitted('pouchdb-livefeed-error')).toHaveLength(1);
235+
236+
//watchers are deferred to the next update cycle that Vue uses to look for changes.
237+
//the change to the selector has a watcher on it in pouch-vue
238+
wrapper.vm.$nextTick(() => {
239+
expect(wrapper.emitted('pouchdb-livefeed-error')).toHaveLength(1);
240+
done();
241+
});
236242
}
237243
test(tryTestName, testFunc);
238244
}

0 commit comments

Comments
 (0)