mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-04-14 16:40:58 -04:00
fix: double state update incorrectly resetting state (#5704)
Co-authored-by: David Luzar <luzar.david@gmail.com>
This commit is contained in:
parent
9cccac1458
commit
9929a2be6f
1 changed files with 5 additions and 1 deletions
|
@ -1153,7 +1153,11 @@ class App extends React.Component<AppProps, AppState> {
|
|||
) {
|
||||
// defer so that the commitToHistory flag isn't reset via current update
|
||||
setTimeout(() => {
|
||||
this.actionManager.executeAction(actionFinalize);
|
||||
// execute only if the condition still holds when the deferred callback
|
||||
// executes (it can be scheduled multiple times depending on how
|
||||
// many times the component renders)
|
||||
this.state.editingLinearElement &&
|
||||
this.actionManager.executeAction(actionFinalize);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue