From 4eadb891f87ffb8d2b2761b7fff843389cec8100 Mon Sep 17 00:00:00 2001 From: Soham Kulkarni <150679961+sohamsk13@users.noreply.github.com> Date: Thu, 3 Jul 2025 12:37:26 +0530 Subject: [PATCH] fix(toast): prevent toast from re-rendering and resetting timeout Fixes #9714 (#9715) * Update App.tsx * fix: lint --------- Co-authored-by: Ryan Di --- packages/excalidraw/components/App.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/excalidraw/components/App.tsx b/packages/excalidraw/components/App.tsx index 54305e4e97..87d1be2779 100644 --- a/packages/excalidraw/components/App.tsx +++ b/packages/excalidraw/components/App.tsx @@ -593,6 +593,10 @@ class App extends React.Component { * insert to DOM before user initially scrolls to them) */ private initializedEmbeds = new Set(); + private handleToastClose = () => { + this.setToast(null); + }; + private elementsPendingErasure: ElementsPendingErasure = new Set(); public flowChartCreator: FlowChartCreator = new FlowChartCreator(); @@ -1707,14 +1711,16 @@ class App extends React.Component { /> )} + {this.state.toast !== null && ( this.setToast(null)} + onClose={this.handleToastClose} duration={this.state.toast.duration} closable={this.state.toast.closable} /> )} + {this.state.contextMenu && (