Skip to content

Commit b264ab4

Browse files
fixed delete passed in props
1 parent d26d759 commit b264ab4

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

app/src/components/StateManagement/CreateTab/components/TableStateProps.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const TableStateProps = props => {
8787
console.log({otherId})
8888
dispatch({
8989
type: 'DELETE STATE',
90-
payload: { stateProps: filtered, rowId: selectedId, otherId: otherId }
90+
payload: { stateProps: filtered, rowId: selectedId, otherId: otherId.id }
9191
});
9292
};
9393

app/src/reducers/componentReducer.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -982,11 +982,15 @@ const reducer = (state: State, action: Action) => {
982982
}
983983
})
984984

985-
component.passedInProps?.forEach((prop, i) => {
986-
if (prop.id === action.payload.rowId || prop.id === action.payload.otherId) {
985+
for (let i = 0; i < component.passedInProps?.length; i++) {
986+
if (component.passedInProps[i]['id'] === action.payload.rowId || component.passedInProps[i]['id'] === action.payload.otherId) {
987+
console.log('prop.id', component.passedInProps[i]['id']);
988+
console.log('rowid',action.payload.rowId)
989+
console.log('otherid',action.payload.otherId)
987990
component.passedInProps.splice(i,1);
991+
i--;
988992
}
989-
});
993+
};
990994
// curr component = where you are deleting from state from, also is the canvas focus
991995
// curr component id = providerId
992996
// we then iterate through the rest of the components

0 commit comments

Comments
 (0)