#[SOLVED] rxdb integration code not working

30 messages · Page 1 of 1 (latest)

vivid sky
ornate lantern
#

Can you let me know what version of appwrite and rxdb you're using

vivid sky
#

"appwrite": "^17.0.2",
"rxdb": "^16.8.1",
releases approx when blog was posted
OR
"appwrite": "^21.5.0",
"rxdb": "^16.21.1",
newest releases

Both of these lead to the same error

    at getJournals (databases.js:119:20)
    at async load (App.jsx:16:16)
load @ App.jsx:18
await in load
(anonymous) @ App.jsx:26
react_stack_bottom_frame @ react-dom_client.js?v=69f92d96:18821
runWithFiberInDEV @ react-dom_client.js?v=69f92d96:1251
commitHookEffectListMount @ react-dom_client.js?v=69f92d96:9665
commitHookPassiveMountEffects @ react-dom_client.js?v=69f92d96:9719
reconnectPassiveEffects @ react-dom_client.js?v=69f92d96:11527
recursivelyTraverseReconnectPassiveEffects @ react-dom_client.js?v=69f92d96:11494
reconnectPassiveEffects @ react-dom_client.js?v=69f92d96:11571
doubleInvokeEffectsOnFiber @ react-dom_client.js?v=69f92d96:13593
runWithFiberInDEV @ react-dom_client.js?v=69f92d96:1251
recursivelyTraverseAndDoubleInvokeEffectsInDEV @ react-dom_client.js?v=69f92d96:13566
commitDoubleInvokeEffectsInDEV @ react-dom_client.js?v=69f92d96:13601
flushPassiveEffects @ react-dom_client.js?v=69f92d96:13411
(anonymous) @ react-dom_client.js?v=69f92d96:13030
performWorkUntilDeadline @ react-dom_client.js?v=69f92d96:33
<App>
exports.createElement @ chunk-WUR7D6NS.js?v=d26fadd3:793
(anonymous) @ main.jsx:8Understand this error
databases.js:113 Replication setup error: ReferenceError: replicationState is not defined
    at setupReplication (databases.js:88:20)
    at getDB (databases.js:76:3)
    at async getJournals (databases.js:118:13)
    at async load (App.jsx:16:16)```
#

and realtime need to be commented out or be given extra variables for the code not to break before that, official code seems outdated on that front

ornate lantern
#

Can you paste your databases.js file?

vivid sky
#

thanks discord thats beautiful formatting

ornate lantern
#

ah alright, wasn't sure if you used that to make your own

vivid sky
#

The plan is to make it dynamic so I can use it to retrieve/post from any table but I guess something changed on appwrite's api so it just doesnt function at all

#

(cause im too dumb to make my own from scratch according to the docs, though the blame there might more be on me and rxdb than appwrite)

ornate lantern
#

oh, in setupReplication does replicationState have it's initializer somewhere?

#

Can you do const replicationState = repliceateAppwrite({...});

vivid sky
#

thats on line 78?

ornate lantern
#

uhhhhh yea

#

There are no variables called replicationState defined

#

seems like a typo to me.

vivid sky
#

im not sure what you mean, the replicationState var is set to the return of the replicateAppwrite function

ornate lantern
#

it is not defined as a variable

#

it needs let const var something

#

otherwise the code doesn't know what to do since it's undefined

#

Which, is what your error is stating ReferenceError: replicationState is not defined

vivid sky
#

that should only be the case in strict mode though 🤔 but yeah that does remove that error

ornate lantern
#

Do you still have the issue, or a new issue?

#

I'm p sure react requires you to use es modules, which will fail to build if you don't use something like const let or var. Older javascript doesn't need it, but modern js does afaik

vivid sky
#

yeah I wasnt aware of that requirement, good catch

cheers though, the code seems to function now

#

now just to figure out how the hell to convert that code into a library of sorts to be usable for multiple tables

ornate lantern
#

Sorry the docs were kinda wonky. I'll forward those issues on.