Comments (8)
There should be a top-level doc about spaces for sure.
Created: https://github.com/rocicorp/mono/issues/51
Edit: meant that issue to be public: #1035
from replicache.
as I am developing locally, I am making big changes to the schema, key, and data returned. I wonder what's the best way to "reset" the stale data? currently, I have to manually clear the browser if not the mutations that have failed would get retried, which makes it hard to debug.
The "clear application data" button in your developer tools is the easiest way to completely wipe client state. It will delete pending mutations and delete your local state, starting fresh.
For mutations in particular, we also recommend while you are early in development skipping failed mutations on the server: https://doc.replicache.dev/server-push#error-handling. In this case, the failed mutations will be ignored and not retried.
Related to resetting the stale data, what's the best practice once it's deployed to production and we would have to do a "migration"? Say that we are changing the shape of the objects we synced, or deprecating some objects, or maybe changing the way structure of the key.
Increment the schemaVersion that you construct replicache with. This will create a new instance of local state and pull a fresh copy of the client view. The schemaVersion
is sent in the pull request as well (https://doc.replicache.dev/server-pull#schemaversion) so that you can handle both client types while the new version is rolling out.
from replicache.
would like to share the research that I have done on spaces for people stumbling upon this thread:
- you can have multiple spaces but each table/resource can only exist in 1 space, multiple spaces cannot track the same table/resource
- join the discord channel, there is a more complex design to recreate Discord as a product, I think this should be included in the main doc.
- there is a roamresearch link in the discord as well that talks more about auth, paging data in and out, and other conceptual thinking for replicache, it links to @aboodman 's personal link.
from replicache.
Technically you can have a piece of data that is in two spaces, however you would have to correctly increment the version on each space that it is a part of whenever that data changes. Which would reduce the transactional throughput of spaces. I don't recommend doing this.
from replicache.
Technically you can have a piece of data that is in two spaces, however you would have to correctly increment the version on each space that it is a part of whenever that data changes.
does this mean, if we have multiple spaces, in the clients table we would need to track which space as well? ex in Prisma:
model Client {
pid String @id @db.Uuid
space String
lastMutationId Int
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
from replicache.
I don't think so? What are you thinking?
from replicache.
nevermind, I think I mistook versioning with mutation id, my thinking was, each space will have its own version, doesn't that mean that the mutation has reached up to that version as well? but if that is the case then there will be repeated mutations run on the server. If i understand correctly, the pairing of mutationId and client is to know whether to run the mutation on the server side?
from replicache.
The lastMutationID and space version have nothing to do with each other.
The naming is somewhat confusing and I apologize for that, the names date to a time when there was more flexibility in Replicache and they made more sense in that context.
But it's really just two version numbers -- one for the client and one for the space:
- Each client sends a stream of mutations to the server over its lifetime, each identified by a sequence number. That's their mutationID. The
lastMutationID
on the server is the last of these the server has processed. It needs to track this for each client to make sure the mutations play in order. - The space also has a version. Each time the space is modified by a mutation (or perhaps by a batch of mutations) the version ticks forward. The server has to track the version so it can compute diffs when clients ask. The client has to track the space version so it can send it in pull requests to get changes.
from replicache.
Related Issues (20)
- Missing nulls in typings
- Discrepancies in Typescript declarations HOT 3
- Support collecting old client records from server HOT 1
- Document spaces HOT 2
- Consider adding WriteTransaction.merge() convenience HOT 1
- Add the ability to encrypt data. HOT 5
- User Request: Support devalue or other alternate serialization format
- ReadTransaction.scan ignores limit option when an indexName is provided
- Add support for other JavaScript types to indexes HOT 3
- RFE: Add a push() method HOT 4
- Question: Subscribing to all changes? HOT 2
- Caching pulls for high scale HOT 1
- RFE: A way to know if/when at least one sync has happened
- Obtaining the version number of the domain object that was last know to the a client? HOT 1
- Invalid ref count during persist HOT 1
- License Key Socket Connection Timeout HOT 2
- Data not persisting through refreshes HOT 2
- Replicache should print a log (at debug) when the cookie doesn't increase
- Link broken HOT 1
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 replicache.