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
The automerge svelte store hides the doc handle so there is no way to do something like
<script>
// automergeimport { Repo } from"@automerge/automerge-repo";import { IndexedDBStorageAdapter } from"@automerge/automerge-repo-storage-indexeddb";import { document, setContextRepo } from"@automerge/automerge-repo-svelte-store";// own stuffimportActualComponentfrom"$lib/components/ActualComponent.svelte";setContextRepo(newRepo({ storage:newIndexedDBStorageAdapter(), network: [], }), );constdoc=document( URL_GOT_ELSEWHERE );
</script>
<!-- wait for the document to become ready, imaginary method by analogy with DocHandle -->
{#awaitdoc.whenReady()}
<div>Loading...</div>
{:then_}
<!-- ActualComponent may assume doc (the store) is ready and $doc is not undefined -->
<ActualComponent {doc} />
{/await}
I'm not sure what makes sense API-wise, maybe just expose the doc handle on the object returned from document, so the first line would be something like:
{#awaitdoc.handle().whenReady()}
The text was updated successfully, but these errors were encountered:
<script>
// automergeimport { Repo } from"@automerge/automerge-repo";import { IndexedDBStorageAdapter } from"@automerge/automerge-repo-storage-indexeddb";import { document, setContextRepo } from"@automerge/automerge-repo-svelte-store";// own stuffimportActualComponentfrom"$lib/components/ActualComponent.svelte";setContextRepo(newRepo({ storage:newIndexedDBStorageAdapter(), network: [], }), );constdocHandle=repo.find( URL_GOT_ELSEWHERE );
</script>
{#awaitdocHandle.whenReady()}
<div>Loading...</div>
{:then_} <!-- the async value of whenReady doesn't matter --><!-- I guess the documents are cached in the repo so now the docHandle inside the store will be ready right away -->
{@constdoc=document( URL_GOT_ELSEWHERE )}
<!-- ActualComponent may assume doc (the store) is ready and $doc is not undefined -->
<ActualComponent {doc} />
{/await}
The automerge svelte store hides the doc handle so there is no way to do something like
I'm not sure what makes sense API-wise, maybe just expose the doc handle on the object returned from
document
, so the first line would be something like:The text was updated successfully, but these errors were encountered: