Summary
Introduce a global context provider for the editor and wire it into the Diagram Editor component so it can consume, modify, and observe application state in a structured and extensible way
Goals
- Establish a single source of truth for editor state.
- Define a clean state shape for MVP.
Non-Goals
- Full state architecture finalization.
- Advanced middleware (undo/redo, devtools, etc. — can come later).
- Complex performance optimization.
Description
1️⃣ Create Context Provider
- Create DiagramEditorCotextProvider component under
src/store/
- The provider should define an initial state based on the editor props and react to those props changes.
2️⃣ Provide access to Context via react hook
- Expose the context via custom hook, "useDiagramEditorContext()"
- Ensure the DiagramEditor component can:
* Read state from the store
* Trigger state updates
* Subscribe to changes
Testing
- Add at least one unit test for:
* Context initialization
* A basic action updating state
Summary
Introduce a global context provider for the editor and wire it into the Diagram Editor component so it can consume, modify, and observe application state in a structured and extensible way
Goals
Non-Goals
Description
1️⃣ Create Context Provider
src/store/2️⃣ Provide access to Context via react hook
* Read state from the store
* Trigger state updates
* Subscribe to changes
Testing
* Context initialization
* A basic action updating state