chore: Attempt filtering new set state

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

View File

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

View File

@@ -8697,7 +8697,22 @@ class App extends React.Component<AppProps, AppState> {
pointerDownState.lastCoords.y = y; pointerDownState.lastCoords.y = y;
pointerDownState.drag.hasOccurred = true; 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; return;
} }