From 04c46fc01a554005d4ed3a8a83c9a9e85d125d0f Mon Sep 17 00:00:00 2001 From: David Luzar Date: Wed, 13 Jan 2021 17:42:42 +0100 Subject: [PATCH] fix: don't render due to zoom after unmount (#2779) * fix: don't render due to zoom after unmount * update changelog * remove unnecessary flush --- src/components/App.tsx | 4 +++- src/packages/excalidraw/CHANGELOG.md | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/App.tsx b/src/components/App.tsx index cdee1645..3126d0f1 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -3816,7 +3816,9 @@ class App extends React.Component { }; private resetShouldCacheIgnoreZoomDebounced = debounce(() => { - this.setState({ shouldCacheIgnoreZoom: false }); + if (!this.unmounted) { + this.setState({ shouldCacheIgnoreZoom: false }); + } }, 300); private getCanvasOffsets(offsets?: { diff --git a/src/packages/excalidraw/CHANGELOG.md b/src/packages/excalidraw/CHANGELOG.md index 865a6447..5b4be70a 100644 --- a/src/packages/excalidraw/CHANGELOG.md +++ b/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)