You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We once had a very simple, beautiful solution for events in pouchdb-hoodie-api: we started listening to PouchDB’s changes feed and used that to emit add, update and change events. But then we hit #54 which caused a timing issue, and after trying for a while to work around the problem while still using the changes feed, we eventually gave up. Instead of listening to the changes feed, we wrap all our methods and emit events manually, see changes here: https://github.com/hoodiehq/pouchdb-hoodie-api/pull/56/files
But I feel there is a better way, and it’s worth looking for it, it would remove a lot of complexity. And whoever finds a solution for this, gets a special Hoodie treat that I’ll have to make up first, but I promise it will be something nice <3
I’d suggest the following steps to get this started
start a PR 🎬
Create a failing test and make it the only one that runs using test.only. Use only PouchDB & EventEmitter to reproduce the problem mentioned in trigger events before methods resolve #54. 🔴
Find a solution 💚
Adjust the failing test to use pouchdb-hoodie-api APIs (see example in trigger events before methods resolve #54) 👍 no longer relevant, the synchronous .hasLocalChanges() API has been removed
Incorporate the solution, make sure all tests pass 👏
Review and merge 🙇
The text was updated successfully, but these errors were encountered:
We once had a very simple, beautiful solution for events in
pouchdb-hoodie-api
: we started listening to PouchDB’s changes feed and used that to emitadd
,update
andchange
events. But then we hit #54 which caused a timing issue, and after trying for a while to work around the problem while still using the changes feed, we eventually gave up. Instead of listening to the changes feed, we wrap all our methods and emit events manually, see changes here: https://github.com/hoodiehq/pouchdb-hoodie-api/pull/56/filesBut I feel there is a better way, and it’s worth looking for it, it would remove a lot of complexity. And whoever finds a solution for this, gets a special Hoodie treat that I’ll have to make up first, but I promise it will be something nice <3
I’d suggest the following steps to get this started
test.only
. Use only PouchDB & EventEmitter to reproduce the problem mentioned in trigger events before methods resolve #54. 🔴Adjust the failing test to useno longer relevant, the synchronouspouchdb-hoodie-api
APIs (see example in trigger events before methods resolve #54) 👍.hasLocalChanges()
API has been removedThe text was updated successfully, but these errors were encountered: