diff --git a/newIDE/app/src/EventsSheet/index.js b/newIDE/app/src/EventsSheet/index.js index a3426c09d8..42b7adb737 100644 --- a/newIDE/app/src/EventsSheet/index.js +++ b/newIDE/app/src/EventsSheet/index.js @@ -521,14 +521,20 @@ export default class EventsSheet extends React.Component { ); eventsRemover.launch(events); - this.setState({ - selection: clearSelection(), - inlineEditing: false, - inlineEditingAnchorEl: null, - }); - this._saveChangesToHistory(() => { - if (this._eventsTree) this._eventsTree.forceEventsUpdate(); - }); + + // /!\ Events were changed, so any reference to an existing event can now + // be invalid. Make sure to immediately trigger a forced update before + // any re-render that could use a deleted/invalid event. + if (this._eventsTree) this._eventsTree.forceEventsUpdate(); + + this.setState( + { + selection: clearSelection(), + inlineEditing: false, + inlineEditingAnchorEl: null, + }, + () => this._saveChangesToHistory() + ); }; copySelection = () => {