Skip to content

Commit 8b48b4b

Browse files
committed
fix: server adaptor bug
1 parent 5272874 commit 8b48b4b

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

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

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,14 @@ export class LoroServerAdaptor implements CrdtServerAdaptor {
3838
let updates: Uint8Array[] | undefined;
3939

4040
if (clientVersion.length > 0) {
41-
try {
42-
const clientVV = VersionVector.decode(clientVersion);
43-
const comparison = serverVersion.compare(clientVV);
44-
45-
if (comparison && comparison > 0) {
46-
const updateData = doc.export({
47-
mode: "update",
48-
from: clientVV,
49-
});
50-
updates = [updateData];
51-
}
52-
} catch {
53-
const snapshot = doc.export({ mode: "snapshot" });
54-
updates = [snapshot];
55-
}
41+
const clientVV = VersionVector.decode(clientVersion);
42+
const updateData = doc.export({
43+
mode: "update",
44+
from: clientVV,
45+
});
46+
updates = [updateData];
5647
} else {
57-
const snapshot = doc.export({ mode: "snapshot" });
58-
updates = [snapshot];
48+
updates = [documentData];
5949
}
6050

6151
const response: JoinResponseOk = {

0 commit comments

Comments
 (0)