perf: strictly memoize Excalidraw callbacks to prevent unnecessary re-renders

This commit is contained in:
ruinivist
2026-06-06 07:54:45 +00:00
parent 01300c7061
commit da4948741e
3 changed files with 25 additions and 11 deletions
+4
View File
@@ -0,0 +1,4 @@
## 2023-10-27 - Excalidraw Component Re-render Performance Penalty
**Learning:** Due to the exceptionally high rendering cost of the `@excalidraw/excalidraw` canvas, inline functions passed as props (like `onChange` and `onExcalidrawAPI`) cause severe performance degradation by defeating `React.memo` and triggering full canvas re-renders when parent state changes.
**Action:** Always strictly memoize all callbacks passed to the Excalidraw component using `useCallback` to preserve prop stability and prevent unnecessary, expensive re-renders.