Skip to content

Remove xstate dependency and simplify implementation#22

Merged
clord merged 1 commit into
masterfrom
claude/simplify-react-enable-011CUK8EKrWzTZG3m6gz9umN
Oct 20, 2025
Merged

Remove xstate dependency and simplify implementation#22
clord merged 1 commit into
masterfrom
claude/simplify-react-enable-011CUK8EKrWzTZG3m6gz9umN

Conversation

@clord
Copy link
Copy Markdown
Member

@clord clord commented Oct 20, 2025

This commit removes the xstate dependency and replaces it with a simpler implementation using React's built-in useReducer hook. All functionality is preserved:

  • Feature state management with three-state model (enabled/disabled/unspecified)
  • Async operations support via onChangeDefault callbacks
  • Layered state architecture (defaults + overrides)
  • Force flag for immutable features
  • Storage persistence
  • Console API
  • All React hooks and UI components

Key changes:

  • Replaced xstate machines with plain reducers in FeatureState.tsx
  • Replaced spawn() pattern with simple object map in FeaturesState.tsx
  • Replaced useMachine with useReducer in Features.tsx
  • Added useEffect to handle async operations
  • Updated usePersist to use value property instead of matches()
  • Removed xstate and @xstate/react from dependencies

All tests pass successfully. The library is now dependency-free (except for @headlessui/react for UI components).

🤖 Generated with Claude Code

@clord clord force-pushed the claude/simplify-react-enable-011CUK8EKrWzTZG3m6gz9umN branch 2 times, most recently from f323b2e to d23aa48 Compare October 20, 2025 22:47
This commit removes the xstate dependency and replaces it with a simpler
implementation using React's built-in useReducer hook. All functionality
is preserved:

- Feature state management with three-state model (enabled/disabled/unspecified)
- Async operations support via onChangeDefault callbacks
- Layered state architecture (defaults + overrides)
- Force flag for immutable features
- Storage persistence
- Console API
- All React hooks and UI components

Key changes:
- Replaced xstate machines with plain reducers in FeatureState.tsx
- Replaced spawn() pattern with simple object map in FeaturesState.tsx
- Replaced useMachine with useReducer in Features.tsx
- Added useEffect to handle async operations
- Updated usePersist to use value property instead of matches()
- Removed xstate and @xstate/react from dependencies

All tests pass successfully. The library is now dependency-free (except
for @headlessui/react for UI components).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@clord clord force-pushed the claude/simplify-react-enable-011CUK8EKrWzTZG3m6gz9umN branch from d23aa48 to e0778a0 Compare October 20, 2025 22:59
@clord clord merged commit a727316 into master Oct 20, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants