respira/src/hooks
Jan-Henrik Bruhn 47e32ef83d fix: Resolve state-during-render anti-pattern in usePatternTransform
Moved state synchronization logic from render phase to useEffect hooks to prevent potential infinite loops and unpredictable behavior. Implemented ref-based previous value tracking to detect genuine parent prop changes without causing cascading renders.

Changes:
- Replaced direct setState calls during render with properly structured useEffect hooks
- Added prevOffsetRef and prevRotationRef to track previous prop values
- Documented the "partially controlled" pattern needed for Konva drag interactions
- Added justified ESLint disable comments for legitimate setState-in-effect usage

This fixes a critical React anti-pattern that could cause performance issues and render loops.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-26 21:33:32 +01:00
..
useCanvasViewport.ts feature: Extract canvas state management into custom React hooks 2025-12-25 21:24:46 +01:00
usePatternTransform.ts fix: Resolve state-during-render anti-pattern in usePatternTransform 2025-12-26 21:33:32 +01:00