craftzdog / pouchdb-adapter-react-native-sqlite

PouchDB adapter using ReactNative SQLite as its backing store
https://github.com/craftzdog/pouchdb-react-native
MIT License
124 stars 21 forks source link

Fix issue #26: Errors when reading from a view for the first time #27

Closed martin-ecatch closed 4 weeks ago

martin-ecatch commented 1 month ago

This is a fix for ticket #26 (Intermittent errors when reading form a view for the first time). There was an extra callback(null) on line 11 in index.ts. This was called without waiting for the database setup. The callback gets called in the correct place in core.ts line 124, so the line 11 in index.ts was superfluous (and the root cause of the race condition).

btw, thank you for this plugin! My Expo app relies on PouchDB and this saved me after Expo decided to completely change their SQLite API.

craftzdog commented 4 weeks ago

good catch, I wasn't aware of the mistake when porting from the websql adapter.

too bad to hear that. maybe you can help him? https://github.com/craftzdog/pouchdb-adapter-react-native-sqlite/pull/24#issuecomment-2287201302