Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions packages/ui/src/lib/store/canvasSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,15 @@ export const createCanvasSlice: StateCreator<MyState, [], [], CanvasSlice> = (
),

getNodesMap() {
return get().ydoc.getMap("rootMap").get("nodesMap") as Y.Map<
Node<NodeData>
>;
const rootMap = get().ydoc.getMap<Y.Map<Node<NodeData>>>("rootMap");
if (!rootMap) {
throw new Error("rootMap not found");
}
const nodesMap = rootMap.get("nodesMap");
if (!nodesMap) {
throw new Error("nodesMap not found");
}
return nodesMap;
},
getEdgesMap() {
return get().ydoc.getMap("rootMap").get("edgesMap") as Y.Map<Edge>;
Expand Down