Jelajahi Sumber

fix: don't render due to zoom after unmount (#2779)

* fix: don't render due to zoom after unmount

* update changelog

* remove unnecessary flush
David Luzar 4 tahun lalu
induk
melakukan
04c46fc01a
2 mengubah file dengan 4 tambahan dan 1 penghapusan
  1. 3 1
      src/components/App.tsx
  2. 1 0
      src/packages/excalidraw/CHANGELOG.md

+ 3 - 1
src/components/App.tsx

@@ -3816,7 +3816,9 @@ class App extends React.Component<ExcalidrawProps, AppState> {
   };
 
   private resetShouldCacheIgnoreZoomDebounced = debounce(() => {
-    this.setState({ shouldCacheIgnoreZoom: false });
+    if (!this.unmounted) {
+      this.setState({ shouldCacheIgnoreZoom: false });
+    }
   }, 300);
 
   private getCanvasOffsets(offsets?: {

+ 1 - 0
src/packages/excalidraw/CHANGELOG.md

@@ -31,6 +31,7 @@ Please add the latest change on the top under the correct section.
 
 ### Fixes
 
+- Fix late-render due to debounced zoom [#2779](https://github.com/excalidraw/excalidraw/pull/2779)
 - Fix initialization when browser tab not focused [#2677](https://github.com/excalidraw/excalidraw/pull/2677)
 - Consistent case for export locale strings [#2622](https://github.com/excalidraw/excalidraw/pull/2622)
 - Remove unnecessary console.error as it was polluting Sentry [#2637](https://github.com/excalidraw/excalidraw/pull/2637)