Skip to content

Conversation

@vgeorge
Copy link
Member

@vgeorge vgeorge commented Nov 7, 2025

Summary

  • Replace XState machine with Zustand store for simplified state management
  • Maintain all existing functionality including bbox selection and feature highlighting
  • Add comprehensive test coverage for new state management

Fixes #916

- Replace XState machine with Zustand store for simpler state management
- Migrate feature highlighting functionality to Zustand
- Migrate bounding box selection workflow to Zustand
- Remove XState dependencies and xstate directory
- All existing tests pass, including E2E bbox interaction test
- Add comprehensive test organization with shared utilities
- Create test_utils.py with common helper functions and constants
- Consolidate validation functions and interaction patterns
- Add bbox selection workflow tests with proper state validation
- Add feature highlighting stability tests
- Improve test maintainability with self-explaining code
- Organize tests by functionality (bbox vs feature highlighting)
- Add shared fixtures in conftest.py for test reuse
- Remove duplicate code patterns across test files
- All 10 tests passing with improved coverage
…ration

- Remove verbose comments and improve import organization in index.tsx
- Clean up formatting in store.ts and toolbar.tsx for better readability
- Add ClassVar type annotations to test constants for type safety
- Improve code formatting and consistency in test files
- Remove unused variables in test files for better maintainability
Copy link
Member

@kylebarron kylebarron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

We currently have two different places for state management:

  • backbone models (via jupyter widgets) for any state coming in from Python
  • xstate -> zustand for any "within JS application/UI state"

Do you think this split makes sense? Should we try to unify all state in a single place?

- Move state files to dedicated src/state/ directory for better organization
- Clean up and standardize JSDoc comments across state management files
- Add clear separation between client-side (Zustand) and Python-synced state
- Improve inline comments in index.tsx for better code readability
- Remove redundant documentation, rely on concise code comments
@vgeorge
Copy link
Member Author

vgeorge commented Nov 10, 2025

@kylebarron thanks for the review. I think we should keep them separate. The parts handled by Zustand don’t need to be exposed, this avoids unnecessary back-and-forth serialization for UI-only state. I added some changes to better document this approach. This is ready for another review.

@vgeorge vgeorge requested a review from kylebarron November 10, 2025 13:19
@vgeorge
Copy link
Member Author

vgeorge commented Nov 13, 2025

@kylebarron I added more test coverage to include the tooltip on feature hover. I won't be adding more changes to this until your feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor XState to simpler state management

3 participants