feat: Introduce spatial workspace architecture design document, enhance layout store item synchronization, and prevent metadata fetch retries.
This commit is contained in:
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user