Comments (3)
Interesting. I would say the second option is preferable to an arbitrary timeout. Or at the very least have some way of exposing to users that the network is not ready before they request a document.
I would have thought that the current implementation does commence sync for an unavailable doc automatically when a new peer connects. If not, I would say it should anyway?
from automerge-repo.
We can implement beginning sync for an unavailable document when a new peer connects quite easily. Right now that would still be an awkward API though I think because it sort of makes the "unavailable" status less useful. In the snippet above the user would have to always wait on whenReady
with some kind of timeout regardless of whether the document resolved as unavailable because they would still need to wait for the network to start up.
I think instead having a kind of "network ready" state for the whole repo might be what is required. That way the user waits for "network ready" and then if a document is unavailable they know that it's not down to the network waiting to come up.
from automerge-repo.
I've been fighting with this a little bit lately. In trail-runner network connections can come and go in the frontend as ServiceWorkers get replaced. My solution right now is to block on calling find until I've set up a network connection but I don't think this is necessarily the best approach.
I think the issue here is that "network ready" isn't monotonic (your network might report being online prematurely or might go offline again as you travel through a tunnel) and also you may already have all the data you need locally. find()
only returns undefined if you don't have the data yet!
In TEE, @geoffreylitt uses a loading screen to guard against trying to do things before connecting. I don't think that's quite the right approach either but it suggests there may be options here.
One thing I've been meaning to do for a while is to start exposing some kind of explanations for why a document didn't load. Was it that there were no peers, that there were peers but nobody would give you the document, was the file corrupted, or was it a bogus input? So many ways to fail.
from automerge-repo.
Related Issues (20)
- Add docs and example for adding authentication to the sync server
- 1.0 Release Blog Post
- Automerge-Repo in a SharedWorker under Vite loses "connect". HOT 1
- Ephemeral message scope HOT 1
- Websocket Version bugs
- Leave means leave HOT 2
- New document sync and save HOT 8
- Delete protocol HOT 1
- Unable to use automerge-repo in Deno: Property 'on' missing from 'Repo'
- Handle unavailable files with no storage/peers better HOT 7
- Storage Snapshots HOT 1
- Storage Snapshots HOT 1
- Lose extra diff HOT 10
- apps under /examples don't seem to work HOT 4
- can't load automerge repo HOT 4
- Allow Svelte's `document` store to explicitely receive the `repo` HOT 4
- Sync server scalability for live collaboration HOT 7
- On failure, and what to do about it HOT 2
- Cover reconnection bug with a test
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from automerge-repo.