fix: Speculative fixes for arrow invariant failures (#11241)
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
This commit is contained in:
@@ -10408,20 +10408,38 @@ class App extends React.Component<AppProps, AppState> {
|
||||
);
|
||||
|
||||
let linearElementEditor = this.state.selectedLinearElement;
|
||||
if (!linearElementEditor) {
|
||||
|
||||
if (
|
||||
!linearElementEditor ||
|
||||
linearElementEditor.elementId !== newElement.id
|
||||
) {
|
||||
linearElementEditor = new LinearElementEditor(
|
||||
newElement,
|
||||
this.scene.getNonDeletedElementsMap(),
|
||||
);
|
||||
}
|
||||
|
||||
const lastClickedPointOutOfBounds =
|
||||
linearElementEditor &&
|
||||
(linearElementEditor.initialState.lastClickedPoint < 0 ||
|
||||
linearElementEditor.initialState.lastClickedPoint >=
|
||||
points.length);
|
||||
if (lastClickedPointOutOfBounds) {
|
||||
console.warn(
|
||||
"Last clicked point is out of bounds. Attempting to fix it.",
|
||||
);
|
||||
linearElementEditor = {
|
||||
...linearElementEditor,
|
||||
selectedPointsIndices: [1],
|
||||
selectedPointsIndices: [points.length - 1],
|
||||
initialState: {
|
||||
...linearElementEditor.initialState,
|
||||
lastClickedPoint: 1,
|
||||
prevSelectedPointsIndices: null,
|
||||
lastClickedPoint: points.length - 1,
|
||||
},
|
||||
hoverPointIndex: points.length - 1,
|
||||
};
|
||||
}
|
||||
|
||||
this.setState({
|
||||
newElement,
|
||||
...LinearElementEditor.handlePointDragging(
|
||||
|
||||
Reference in New Issue
Block a user