Commit graph

3 commits

Author SHA1 Message Date
copilot-swe-agent[bot]
5296590a45 fix: Revert pattern validation to local hook to prevent infinite re-renders
The selectPatternValidation selector doesn't work well with Zustand because:
1. It requires machineInfo parameter from a different store
2. Passing machineInfo creates new object references on every render
3. This breaks Zustand's memoization and causes infinite loops

Solution:
- Reverted usePatternValidation.ts to original implementation with useMemo
- Removed selectPatternValidation and usePatternValidationFromStore
- Removed PatternValidationResult type (not needed)
- Updated tests to remove validation selector tests (12 tests remain)

The store selectors (selectPatternCenter, selectRotatedBounds, etc) are
still useful for components that only need those specific values, but
validation logic that depends on external state should stay local.

Co-authored-by: jhbruhn <1036566+jhbruhn@users.noreply.github.com>
2025-12-28 08:17:20 +00:00
copilot-swe-agent[bot]
6fbb3ebf1a fix: Add missing bounds field to mock PenStitches in tests
Co-authored-by: jhbruhn <1036566+jhbruhn@users.noreply.github.com>
2025-12-27 17:00:05 +00:00
copilot-swe-agent[bot]
1d79ffb2a4 feature: Add computed selectors to usePatternStore for pattern transformations
- Add selectPatternCenter for pattern center calculation
- Add selectRotatedBounds for rotated bounds with memoization
- Add selectRotationCenterShift for center shift calculation
- Add selectPatternValidation for bounds checking against hoop
- Add comprehensive tests for all selectors
- Update usePatternValidation to use store selectors
- All tests passing and linter clean

Co-authored-by: jhbruhn <1036566+jhbruhn@users.noreply.github.com>
2025-12-27 16:56:54 +00:00