You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Requesting a document with repo.find from a peer (e.g., a sync server) will fail if the sharePolicy doesn't return true on the peer id.
The following code reproduces the error as the document here will never load.
import * as AutomergeWasm from "@automerge/automerge-wasm"
import * as Automerge from "@automerge/automerge"
import { Repo } from "@automerge/automerge-repo"
import { IndexedDBStorageAdapter } from "@automerge/automerge-repo-storage-indexeddb"
import { BrowserWebSocketClientAdapter } from "@automerge/automerge-repo-network-websocket"
async function initializeRepo() {
console.log("Creating repo")
const repo = new Repo({
storage: new IndexedDBStorageAdapter(),
network: [new BrowserWebSocketClientAdapter(`wss://sync.automerge.org`)],
peerId: "client-" + Math.round(Math.random() * 1000000),
sharePolicy: async (peerId) => false,
})
await AutomergeWasm.promise
return repo
}
const repo = await initializeRepo()
let handle = repo.find(`automerge:4UJNqDEtH5Eit5cs4uo1inxpMtpW`)
await handle.whenReady();
let doc = await handle.doc();
console.log("doc", doc);
The text was updated successfully, but these errors were encountered:
Requesting a document with
repo.find
from a peer (e.g., a sync server) will fail if the sharePolicy doesn't return true on the peer id.The following code reproduces the error as the document here will never load.
The text was updated successfully, but these errors were encountered: