Comments (3)
Hi @michielbdejong. The goal of ReplicaCache
is to provide a synchronous API to the (asynchronous) Replica
, in order to be easily used by certain libraries or frameworks. It does this by watching for events from Replica
, and seeing if they contain any documents which have been queried for previously. If a document satisfies this criteria, it adds it to an in-memory cache of documents.
The reason the page is rendering before any data is available is because ReplicaCache
must synchronously return a result when it is queried.
- On the first call, it does not have anything its cache, so it returns an empty result.
- Then In the background it works to (asynchronously) retrieve the result, and fires an update when it has it.
- This result is then added to
ReplicaCache
's in-memory cache of documents, so that it can be retrieved synchronously thereafter.
In short, the reason you do not see any results until you call cache.queryDocs
is because the ReplicaCache
does not know what you are interested in until you do.
from earthstar.
This is not a blocker for me, I can work around it now that I know about it, but it felt quirky so I'm simply curious why this works this way.
And thanks for this awesome project btw!
from earthstar.
Thanks, that makes a lot of sense now!
from earthstar.
Related Issues (20)
- Upgrade SQLite3 dependency to 0.8.0
- Address private set intersection exploit HOT 2
- What is the rationale for the generateAuthorKeypair shortname only allowing lengths of 4 chars? HOT 1
- npm install error HOT 1
- Adding denoKV to doc drivers HOT 4
- Error compiling typescript file that imports earthstar npm package
- ExtensionKnownShares loading known shares from memory HOT 1
- Export a browser entrypoint with IndexedDB StorageDriver
- Port Discovery API + DiscoveryLan
- Add way to check if Auth has been set up yet
- Add way to check if given password is correct on Auth
- Auth should be an EventTarget and emit events
- Peer should be an EventTarget and emit events
- IdentityKeypair + ShareKeypair secretKey property should be Base32 encoded string
- "All-in-one" authorisation
- Lots of duplicate auth stuff in the store HOT 5
- Filter sparse documents from store results unless specifically requested
- Cinn25519 shortname encoding is incorrect
- TypeError: The input must be a Uint8Array, a string, or an ArrayBuffer. Received a value of the type undefined. HOT 3
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 earthstar.