Merge pull request #58 from jhbruhn/feature/react-memo-optimization

feature: Enhance Konva rendering with React.memo optimization
This commit is contained in:
Jan-Henrik Bruhn 2025-12-27 17:14:54 +01:00 committed by GitHub
commit d213ab49e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,7 +5,7 @@
* Handles both interactive (draggable/rotatable) and locked states * Handles both interactive (draggable/rotatable) and locked states
*/ */
import { useMemo, type RefObject } from "react"; import { useMemo, memo, type RefObject } from "react";
import { Group, Transformer } from "react-konva"; import { Group, Transformer } from "react-konva";
import type Konva from "konva"; import type Konva from "konva";
import type { KonvaEventObject } from "konva/lib/Node"; import type { KonvaEventObject } from "konva/lib/Node";
@ -30,7 +30,7 @@ interface PatternLayerProps {
attachTransformer?: () => void; attachTransformer?: () => void;
} }
export function PatternLayer({ export const PatternLayer = memo(function PatternLayer({
pesData, pesData,
offset, offset,
rotation = 0, rotation = 0,
@ -143,4 +143,4 @@ export function PatternLayer({
)} )}
</> </>
); );
} });