diff --git a/apps/web/src/components/spaces-grid.tsx b/apps/web/src/components/spaces-grid.tsx
index 80adf05..4524eee 100644
--- a/apps/web/src/components/spaces-grid.tsx
+++ b/apps/web/src/components/spaces-grid.tsx
@@ -147,79 +147,80 @@ export function SpacesGrid() {
{/* Spaces Grid */}
- {filteredSpaces.map((space) => (
-
{
- window.location.href = `/space?id=${space.id}`;
- }}
- >
-
-
-
-
-
- {space.name}
-
+ {filteredSpaces.map((space) => {
+ const snapshot = space.snapshotText
+ ? JSON.parse(space.snapshotText).document
+ : undefined;
+ return (
+
{
+ window.location.href = `/space?id=${space.id}`;
+ }}
+ >
+
+
-
-
-
+
-
-
-
+
+ {
- editor.updateInstanceState({ isReadonly: true });
- }}
- snapshot={
- space.snapshotText
- ? JSON.parse(space.snapshotText).document
- : undefined
- }
- />
-
-
+ }}
+ className="min-h-52"
+ hideUi
+ onMount={(editor) => {
+ editor.updateInstanceState({ isReadonly: true });
+ }}
+ snapshot={snapshot}
+ />
+
+
-
- {space.itemCount} items
- Edited {space.lastEdited}
-
-
- ))}
+
+ {snapshot?.itemCount} items
+ Edited {space.lastEdited}
+
+
+ );
+ })}
{/* Empty State (when no spaces exist) */}
diff --git a/apps/web/src/lib/appwrite-db.ts b/apps/web/src/lib/appwrite-db.ts
index 9920db0..60b1c74 100644
--- a/apps/web/src/lib/appwrite-db.ts
+++ b/apps/web/src/lib/appwrite-db.ts
@@ -100,6 +100,8 @@ export async function upsertSpaceSnapshot(
spaceId,
userId: uid,
snapshot: JSON.stringify(payload),
+ title: existing?.title,
+ color: existing?.color,
} as const;
if (existing) {
diff --git a/apps/web/src/routes/space.tsx b/apps/web/src/routes/space.tsx
index a8b1f81..f219256 100644
--- a/apps/web/src/routes/space.tsx
+++ b/apps/web/src/routes/space.tsx
@@ -9,6 +9,7 @@ import {
} from "tldraw";
import { z } from "zod";
import "tldraw/tldraw.css";
+import Loader from "@/components/loader";
import {
getLatestSpaceSnapshot,
type RemoteSnapshot,
@@ -78,6 +79,10 @@ function SpaceRoute() {
};
}, [id, session, store]);
+ if (!(id && session)) {
+ return ;
+ }
+
return (