perf: memoize EditorCanvas to prevent unnecessary re-renders

This commit is contained in:
ruinivist
2026-06-01 07:37:59 +00:00
parent 95d27c5142
commit aed3ed2e8b
2 changed files with 8 additions and 2 deletions
+5 -2
View File
@@ -1,3 +1,4 @@
import { memo } from "react";
import "../../../node_modules/@excalidraw/excalidraw/dist/prod/index.css";
import { Excalidraw } from "@excalidraw/excalidraw";
import type {
@@ -33,7 +34,9 @@ function sceneFromEditor(
};
}
export function EditorCanvas({
// ⚡ Bolt: Wrapped in React.memo to prevent expensive Excalidraw re-renders
// when parent state (like the sidebar open state or drawing title input) changes.
export const EditorCanvas = memo(function EditorCanvas({
activeId,
scene,
loading,
@@ -58,4 +61,4 @@ export function EditorCanvas({
/>
</div>
);
}
});