rxdb
rxdb copied to clipboard
Fix react-native example based expo
This PR contains
Updated example for react-native based on Expo. Main changes
- rxdb version fixed to 12 to prevent errors after main repo upgrade.
- react-native downgraded 0.64.3 according expo recomendations
Todos
The sync doesn't work. I have no idea how to do it without server. I can fix it if anybody point what to do
A main reason for having these example projects, is to know when a change on the rxdb code breaks compatibility. So I do not want to install rxdb from npm but it should use the build rxdb bundle. Also having a fixed version there would mean that someone has to come and update it on each rxdb release.
Ok, changed back. Added comment in readme.md.
Can you update this line https://github.com/pubkey/rxdb/blob/master/.github/workflows/main.yml#L450
So that it does use the node version from the node-version-file: '.nvmrc'
like in the other ci tasks.
expo-cli doesn't support node 18. https://github.com/expo/expo-cli/issues/4478
I see. I am not sure if we should merge this then. Because we increase the expo version but decrease the react-native version, which does not lead to any benefit.
I see. I am not sure if we should merge this then. Because we increase the expo version but decrease the react-native version, which does not lead to any benefit.
But current code don't work any case :-)
Now updated only expo-cli. I leave old expo package and it have recommendations https://docs.expo.dev/versions/latest/#each-expo-sdk-version-depends-on-a. It was downgraded to prevent notification.
I'll try to update all deps
With jest-expo >= 44 tests passes, but finishes with seg fauilt (yarn and npm same). Now its works.
Replication does not work because you switched from the pouchdb RxStorage to the memory RxStorage. But the replication code uses the CouchDB replication protocol which only works with PouchDB RxStorage.
Is there a reason why you switched to the memory adapter? Because PouchDB is the only persistent RxStorage for react native, so the whole reason for the react-native example is to explain how to store data in it with the PouchDB RxStorage.
Is there a reason why you switched to the memory adapter? Because PouchDB is the only persistent RxStorage for react native, so the whole reason for the react-native example is to explain how to store data in it with the PouchDB RxStorage.
The entire PouchDb ecosystem is very outdated. For example, pouchdb-adapter-asyncstorage uses the deprecated async-storage (it was moved to community package). I had patched that package and fix that - the persistance works, but it doesn't fix sync. I tried to find working packages, but only the sqlite package with a bunch of crutches worked.
So, for this PR, we should deside what requirements are needed:
- persistence?
- sync throught http?
- ... ?
Yes both is needed. The reason for making the react native example was to show that RxDB can work with the react-native SQLite storage. We can switch from couchdb-sync to the rxdb replication of course.
I assume this PR is made in context of the premium tasks, is that correct?
Yes both is needed. The reason for making the react native example was to show that RxDB can work with the react-native SQLite storage. We can switch from couchdb-sync to the rxdb replication of course.
I assume this PR is made in context of the premium tasks, is that correct?
Previous version doesn't use sqlite, it uses asyncstorage.
I have some success with custom version of pouchdb-adapter-react-native-sqlite
in my project. But yes, I want to try your version of sqlite connector because, as I mention before, the whole pouchdb ecosystem is outdated.
I'll try to change the adapter to sqlite in this example project.
Recent changes:
- Dependencies updated to current versions - [email protected], [email protected], [email protected], [email protected]
- Sync has fixed and tested with [email protected] instance (not included). Also, tested with [email protected] - doesn't work.
There is no persistance functionality. Pouchdb need a crunches and Sqlite need a native modules to work. I don't want to deal with it for Expo. My suggestion is - rename this module to react-native-expo and leave as is in this PR. And create a new one with bare react-native.
-
Persistence with
pouchdb-adapter-asyncstorage
will work after this PR https://github.com/seigel/pouchdb-react-native/pull/154 -
Tests had fixed
Strange error, I restarted the failed CI test.
I removed the cache settings. In any case, there is no package-lock file. And if I understood you correctly - you want to always have fresh packages.
The buggy jest and CI. I don't know how to fix it. Tests passed locally. Lost my patience. I'll be back later.
So... Now we will test database.
The code looks good to me. What is the state of the sync now? I see it connects to 'http://admin:mysecret1@localhost:5984' but there is nothing started at this port. As far as I remember the pouchdb sync did work before, or was it broken anyway?
The code looks good to me. What is the state of the sync now? I see it connects to 'http://admin:mysecret1@localhost:5984' but there is nothing started at this port. As far as I remember the pouchdb sync did work before, or was it broken anyway?
There was the similar code before^
const syncURL = 'http://localhost:10102/'; // Replace localhost with a public ip address!
I haven't seen this code works. I haven't seen any server side also.
Ah, you are right, sorry havent seen that there never was a server. So I can merge this now?
Counting for it :-)
Merged, thank you for your work. You can ping me in discord for the access to the premium plugins.