Skip to content

Commit b84eb63

Browse files
lodyai[bot]lody-ai
andauthored
feat(adaptors): upgrade flock to 4.1.0 and use inclusiveVersion for sync check (#45)
- Update @loro-dev/flock peerDependency to ^4.1.0 in loro-adaptors - Update @loro-dev/flock devDependency to ^4.1.0 in loro-websocket - Use flock.version() for encoding (sending to server) - Use flock.inclusiveVersion() for waitForReachingServerVersion check The inclusiveVersion() includes all peers ever seen, making it correct for checking if we have received all data from the server, while version() only includes peers with current entries, which is correct for incremental sync. Co-authored-by: lody <agent@lody.ai>
1 parent 858a1e9 commit b84eb63

4 files changed

Lines changed: 78 additions & 78 deletions

File tree

packages/loro-adaptors/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"loro-protocol": "workspace:*"
1616
},
1717
"peerDependencies": {
18-
"@loro-dev/flock": "^4.0.0",
18+
"@loro-dev/flock": "^4.1.0",
1919
"loro-crdt": "^1.9.0",
2020
"yjs": "*"
2121
},

packages/loro-adaptors/src/flock-adaptor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export class FlockAdaptor implements CrdtDocAdaptor {
155155
try {
156156
const serverVersion = decodeVersionVector(res.version);
157157
this.initServerVersion = serverVersion;
158-
const comparison = compareVersions(this.flock.version(), serverVersion);
158+
const comparison = compareVersions(this.flock.inclusiveVersion(), serverVersion);
159159
if (comparison != null && comparison >= 0) {
160160
this.markReachedServerVersion();
161161
}
@@ -195,7 +195,7 @@ export class FlockAdaptor implements CrdtDocAdaptor {
195195
this.lastExportVersion = (this.flock.version());
196196
if (this.initServerVersion && !this.hasReachedServerVersion) {
197197
const comparison = compareVersions(
198-
this.flock.version(),
198+
this.flock.inclusiveVersion(),
199199
this.initServerVersion
200200
);
201201
if (comparison != null && comparison >= 0) {

packages/loro-websocket/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"ws": "^8.18.3"
7373
},
7474
"devDependencies": {
75-
"@loro-dev/flock": "^4.0.0",
75+
"@loro-dev/flock": "^4.1.0",
7676
"get-port": "^7.1.0",
7777
"tsdown": "^0.14.1",
7878
"tsx": "^4.20.5",

pnpm-lock.yaml

Lines changed: 74 additions & 74 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)