State Management (Zustand)
Installation
SKILL.md
State Management (Zustand)
Store Architecture
PIXLAYER uses a single Zustand store (editorStore) with logical slices.
Complete Store
// client/src/store/editorStore.js
import { create } from 'zustand';
import { v4 as uuid } from 'uuid';
export const useEditorStore = create((set, get) => ({
// ──────── Image Slice ────────
currentImage: null, // { src: string, width: number, height: number, fileName: string, fileSize: number }
imageEmbedding: null, // Cached SAM2 ONNX tensor