chore: Attempt filtering new set state

This commit is contained in:
Mark Tolmacs
2025-08-15 22:42:09 +02:00
parent c23d78d42c
commit 2592cf7da8
2 changed files with 17 additions and 3 deletions

View File

@@ -492,10 +492,9 @@ export class LinearElementEditor {
};
return {
...app.state,
selectedLinearElement: newLinearElementEditor,
suggestedBindings,
};
} as Pick<AppState, keyof AppState>;
}
return null;

View File

@@ -8861,7 +8861,22 @@ class App extends React.Component<AppProps, AppState> {
pointerDownState.lastCoords.y = y;
pointerDownState.drag.hasOccurred = true;
this.setState(newState);
if (
!isShallowEqual(
newState.suggestedBindings ?? [],
this.state.suggestedBindings,
) ||
!isShallowEqual(
newState.selectedLinearElement?.selectedPointsIndices ?? [],
this.state.selectedLinearElement?.selectedPointsIndices ?? [],
) ||
newState.selectedLinearElement?.hoverPointIndex !==
this.state.selectedLinearElement?.hoverPointIndex ||
newState.selectedLinearElement?.customLineAngle !==
this.state.selectedLinearElement?.customLineAngle
) {
this.setState(newState);
}
return;
}