WatermelonDB icon indicating copy to clipboard operation
WatermelonDB copied to clipboard

getting closer with watermelon

Open earonesty opened this issue 1 year ago • 5 comments

totally works on ios/node

last remaining error:

05-26 14:08:53.267 11905 12098 E unknown:ReactNative: Exception in native call
05-26 14:08:53.267 11905 12098 E unknown:ReactNative: com.facebook.react.bridge.NativeArgumentsParseException: DatabaseBridge.initialize got 5 arguments, expected 6
05-26 14:08:53.267 11905 12098 E unknown:ReactNative:   at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:349)
05-26 14:08:53.267 11905 12098 E unknown:ReactNative:   at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188)
05-26 14:08:53.267 11905 12098 E unknown:ReactNative:   at com.facebook.jni.NativeRunnable.run(Native Method)
05-26 14:08:53.267 11905 12098 E unknown:ReactNative:   at android.os.Handler.handleCallback(Handler.java:883)
05-26 14:08:53.267 11905 12098 E unknown:ReactNative:   at android.os.Handler.dispatchMessage(Handler.java:100)
05-26 14:08:53.267 11905 12098 E unknown:ReactNative:   at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
05-26 14:08:53.267 11905 12098 E unknown:ReactNative:   at android.os.Looper.loop(Looper.java:214)
05-26 14:08:53.267 11905 12098 E unknown:ReactNative:   at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)
05-26 14:08:53.267 11905 12098 E unknown:ReactNative:   at java.lang.Thread.run(Thread.java:919)
05-26 14:08:53.295 11905 12097 I ReactNativeJS: { _workQueue: { _queue: [], _subActionIncoming: false, _db: [Circular] },

gonna assume this is a versioning thing? we are running expo, but i manually configured everything in gradle, etc to get it to this point. gonna play with bumping watermelon to different versions.

earonesty avatar May 26 '23 18:05 earonesty

ok, got this to work too. i downgraded watermelon to < 0.26, and it works now

new error looks like application logic issue, we get 100's of these

05-26 15:03:45.193 16249 16335 W ReactNativeJS: [🍉] The writer you're trying to run (unnamed) can't be performed yet, because there are 52 other readers/writers in the queue. Current writer: unnamed. If everything is working fine, you can safely ignore this message (queueing is working as expected). But if your readers/writers are not running, it's because the current writer is stuck. Remember that if you're calling a reader/writer from another reader/writer, you must use callReader()/callWriter(). See docs for more details.

kinda a real issue. i need a way of "waiting" for the queue

earonesty avatar May 26 '23 19:05 earonesty

ok, i wrapped it in a async-mutex, that fixed the console spew and finally gives a consistent view of the db (but of course now it's super slow). going to investigate the sync api thing. that might help

earonesty avatar May 26 '23 22:05 earonesty

the sync api seems to rely on watermelon dictating the ids. unfortunately, i can't use those id's. our server and schema is highly constrained, and we must use the id's (immutable deterministic id) it passes, and we cannot store "extra" data. i was just using a second id for my rows, but the backend cant store "watermelon ids", so sync won't cut it. gonna try to roll my own sink

would be nice if watermelon allowed the user to specify id's for new records. our application uses hashed id's so the server never needs to generate ids. but watermelon assumes it is the generator. for cryptographic reasons, we cannot use them. but we could supply watermelon with a terse string uuid that it can use!

earonesty avatar May 26 '23 22:05 earonesty

https://watermelondb.dev/docs/Advanced/ProTips#override-entity-id-generator

KrisLau avatar Jun 05 '23 13:06 KrisLau

Does watermelon work with expo out of the box?

Ngomana avatar Oct 02 '23 23:10 Ngomana