From eb0b9fcaf2e0b3db2ae36d1b7992f9e171135273 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Tue, 28 Apr 2026 18:30:31 +0200 Subject: [PATCH] Memoize selected brush face IDs calculation --- src/app/App.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/App.tsx b/src/app/App.tsx index cfab0e0e..a8462358 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -1,5 +1,6 @@ import { useEffect, + useMemo, useRef, useState, type CSSProperties, @@ -2363,8 +2364,10 @@ export function App({ store, initialStatusMessage }: AppProps) { : (editorState.document.materials[selectedBrushSharedMaterialId] ?? null); const selectedBrushHasMixedFaceMaterials = selectedBrush !== null && selectedBrushSharedMaterialId === undefined; - const selectedBrushFaceIds = - selectedBrush === null ? [] : getBrushFaceIds(selectedBrush); + const selectedBrushFaceIds = useMemo( + () => (selectedBrush === null ? [] : getBrushFaceIds(selectedBrush)), + [selectedBrush] + ); const selectedBrushHasMixedFaceUvs = selectedBrush !== null ? selectedBrushFaceIds