feat: Introduce spatial workspace architecture design document, enhance layout store item synchronization, and prevent metadata fetch retries.

This commit is contained in:
2025-11-26 22:03:09 +01:00
parent e36732cc2d
commit 0c6504ef1c
3 changed files with 40 additions and 10 deletions
+16 -2
View File
@@ -124,10 +124,24 @@ const DesktopWorkspace: React.FC<DesktopWorkspaceProps> = ({
useEffect(() => {
if (tenantId && viewId) {
// Clear store when switching views to prevent stale items
layoutStore.clear();
layoutStore.loadLayout(String(tenantId), viewId);
}
}, [layoutStore, tenantId, viewId]);
// Sync LayoutStore items with current entries to remove stale items
useEffect(() => {
const currentIds = new Set(items.map((doc, index) => doc.id ? String(doc.id) : `temp-${index}`));
// Identify and remove items that are no longer present
for (const id of layoutStore.items.keys()) {
if (!currentIds.has(id)) {
layoutStore.unregister(id);
}
}
}, [items, layoutStore]);
// Selection Context
const {
selectedDocumentIds,
@@ -216,8 +230,8 @@ const DesktopWorkspace: React.FC<DesktopWorkspaceProps> = ({
const size = ensureDocumentSize(doc);
const layoutCard = layoutStore.initialize(docId, null, {
width: size.width,
height: size.height
width: Number.isFinite(size.width) && size.width > 0 ? size.width : 200,
height: Number.isFinite(size.height) && size.height > 0 ? size.height : 200
});
return (