perf: memoize EditorCanvas to prevent unnecessary re-renders
This commit is contained in:
@@ -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>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user