Skip to content

Commit 4b8e2dd

Browse files
Copilotmikebarkmin
andcommitted
Export Zustand stores and add documentation comments
Co-authored-by: mikebarkmin <2592379+mikebarkmin@users.noreply.github.com>
1 parent 5c7bc2d commit 4b8e2dd

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

packages/learningmap/src/editorStore.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { temporal } from 'zundo';
33
import { Node, Edge, applyNodeChanges, applyEdgeChanges, addEdge, NodeChange, EdgeChange, Connection } from '@xyflow/react';
44
import { NodeData, RoadmapData, Settings, ImageNodeData, TextNodeData } from './types';
55

6+
// Note: This is a global store for the editor. Typically only one editor instance is active at a time.
7+
// If you need multiple independent editor instances, consider creating store instances per component or using context.
68
export interface EditorState {
79
// Core data
810
nodes: Node<NodeData>[];

packages/learningmap/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ export type { RoadmapData, RoadmapState } from "./types";
77
export type { LearningMapProps } from "./LearningMap";
88
export type { LearningMapEditorProps } from "./LearningMapEditor";
99
export { LearningMap, LearningMapEditor };
10+
export { useEditorStore, useTemporalStore } from "./editorStore";
11+
export { useViewerStore } from "./viewerStore";

packages/learningmap/src/viewerStore.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { create } from 'zustand';
22
import { Node, Edge, applyNodeChanges, NodeChange } from '@xyflow/react';
33
import { NodeData, RoadmapData, RoadmapState, Settings } from './types';
4-
import { persist, createJSONStorage } from 'zustand/middleware';
54

5+
// Note: This is a global store. If you need multiple independent LearningMap instances
6+
// on the same page, consider creating store instances per component or using context.
67
export interface ViewerState {
78
// Core data
89
nodes: Node<NodeData>[];

0 commit comments

Comments
 (0)