Skip to content

Commit 87af525

Browse files
committed
fix: track reordered ConnectionActions
1 parent a3e81d8 commit 87af525

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/uhk-web/src/app/store/reducers/user-configuration.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,7 @@ export function reducer(
901901
case UserConfig.ActionTypes.ReorderHostConnections: {
902902
const payload = (action as UserConfig.ReorderHostConnectionsAction).payload;
903903
const userConfiguration: UserConfiguration = Object.assign(new UserConfiguration(), state.userConfiguration);
904+
const processedConnectionActions = new WeakSet<ConnectionsAction>()
904905
userConfiguration.hostConnections = payload.map((reorderedConnection, index) => {
905906
if (reorderedConnection.index === index) {
906907
return reorderedConnection;
@@ -913,9 +914,12 @@ export function reducer(
913914
layer.modules = layer.modules.map(module => {
914915
module = Object.assign(new Module(), module);
915916
module.keyActions = module.keyActions.map(keyAction => {
916-
if (keyAction instanceof ConnectionsAction && keyAction.hostConnectionId === reorderedConnection.index) {
917+
if (keyAction instanceof ConnectionsAction
918+
&& keyAction.hostConnectionId === reorderedConnection.index
919+
&& !processedConnectionActions.has(keyAction)) {
917920
const newKeyAction = new ConnectionsAction(keyAction);
918921
newKeyAction.hostConnectionId = index;
922+
processedConnectionActions.add(newKeyAction);
919923

920924
return newKeyAction;
921925
}

0 commit comments

Comments
 (0)