orbitdb / orbit-db-control-center

UI for managing OrbitDB databases
86 stars 35 forks source link

No entries visible for remotely connected orbitdb #2

Open ohager opened 4 years ago

ohager commented 4 years ago

Context

I have an application with OrbitDB using a remote IPFS daemon (actually, all running on the same machine).

I changed your code a bit such that I can connect to that local IPFS peer, because I wasn't able to open my databases using your demoed web version.

import IpfsClient from 'ipfs-http-client'

// ...

// Start OrbitDB
export const initOrbitDB = async () => {
  orbitdb = await OrbitDB.createInstance(IpfsClient('http://localhost:5001'))
  return orbitdb
}

I configured CORS for my IPFS peer, such that it works without issues

Actual Behavior

After these changes I was able to open the database, and as you can see they are correctly detected.

image

The issue is that, even having douments stored, no entries are shown, when added programmatically in my application.

image

Expected Behavior

When adding documents to the OrbitDB, they should appear in the Control Center


I'm not sure that this is an issue with your useful viewer, or something I forgot to do on my apps side. In my innocent understanding, I expect an implicit replication of the data. Maybe you can help me on this.

Thanks in advance

haadcode commented 4 years ago

Thanks @ohager for opening the issue! 👍

I don't think the replication updates are hooked up to the UI. That is, even if your peers are syncing / have synced the database, the UI doen't update. It may work if you "let it run for a while" once the peers are connected, and then refresh the UI. It may be some other bug, too.

Would graldly accept a PR that adds/fixes that.

ohager commented 4 years ago

Understood. Locally, I added the replicated event, but it wasn't triggered. @phillmac gave me some hints how to work on the peer discovery. Probably, I'll look into that issue tonight evening. Once I made the replication work, I'll see if I can make it work in the control-center. I'll let you know.

haadcode commented 4 years ago

Sounds good. Btw. the event on local peer (writer) is write, and replicated on the remote peer (the one replicating). See if that triggers correctly.