Skip to content

State Management System #194

@KubrickCode

Description

@KubrickCode

Predictable state changes with Redux-inspired state management.

type ApplicationState = {
  config: {
    currentTarget: ConfigurationTarget;
    buttons: ButtonConfig[];
    validationErrors: ValidationError[];
  };
  buttonSets: {
    sets: ButtonSet[];
    activeSet: string | null;
  };
  execution: {
    history: ExecutionHistoryEntry[];
    terminals: Map<string, TerminalState>;
  };
};

class StateManager {
  dispatch<T>(action: Action<T>): Promise<void>;
  getState(): Readonly<ApplicationState>;
  subscribe(selector: StateSelector, callback: SubscriberCallback): Disposable;

  // Time-travel debugging
  getStateHistory(): ApplicationState[];
  replayActions(actions: Action[]): void;
}

Reason: State predictability
Current: State is distributed across multiple managers
Improvement: Single state store + action-based changes

  • Easier debugging (state change tracking)
  • Natural implementation of Undo/Redo

Metadata

Metadata

Assignees

Labels

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions