Skip to content

Commit d538332

Browse files
apply version to doc
1 parent ba7159f commit d538332

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

apps/client/src/lib/services/loro-storage.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Activity, type LoroSchema } from "@local/schema";
1+
import { Activity, VERSION, type LoroSchema } from "@local/schema";
22
import { Effect, Schema } from "effect";
33
import { LoroDoc, LoroMap, VersionVector } from "loro-crdt";
44
import { TempWorkspace } from "./temp-workspace";
@@ -21,6 +21,7 @@ export class LoroStorage extends Effect.Service<LoroStorage>()("LoroStorage", {
2121
).pipe(
2222
Effect.map(({ workspace, tempWorkspace }) => {
2323
const doc = new LoroDoc<LoroSchema>();
24+
doc.getMap("metadata").set("version", VERSION);
2425

2526
if (workspace !== undefined) {
2627
doc.import(workspace.snapshot);

apps/client/src/routes/$workspaceId/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ const bootstrap = ({ workspaceId }: { workspaceId: string }) =>
2525
{ type: "module" }
2626
)
2727
)
28-
)
28+
),
29+
Effect.catchAll((error) => Effect.logError("Bootstrap error", error))
2930
);
3031

3132
export const Route = createFileRoute("/$workspaceId/")({

apps/client/src/workers/sync.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const WorkerLive = WorkerRunner.layerSerialized(WorkerMessage, {
3030
if (tempUpdates !== undefined) {
3131
const docI = new LoroDoc<LoroSchema>();
3232
docI.import(tempUpdates.snapshot);
33-
yield* Effect.log("Doc", tempUpdates, docI.toJSON());
33+
yield* Effect.log("Doc", docI.toJSON());
3434

3535
yield* push({
3636
workspaceId: workspace.workspaceId,

0 commit comments

Comments
 (0)