Skip to content

Commit 5f9eec1

Browse files
Co-authored-by: carlyjackson <[email protected]>
Co-authored-by: BenCauffman <[email protected]> Co-authored-by: Ahsan Rao <[email protected]> Co-authored-by: Darin <[email protected]>
2 parents 5aa644c + 1facd52 commit 5f9eec1

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ const Table3 = props => {
5656
<Button
5757
style={{ width: `${3}px`, color: 'black'}}
5858
onClick={() => {
59-
console.log('params inside button', params)
59+
console.log('params inside delete button', params)
60+
console.log('params.id inside delete button', params.id)
6061
deleteParentProps(params.row, params.id);
6162
}}
6263
>
@@ -138,8 +139,9 @@ const Table3 = props => {
138139
columns={gridColumns}
139140
pageSize={5}
140141
editRowsModel={editRowsModel}
141-
onRowClick={deleteParentProps}
142+
// onRowClick={deleteParentProps}
142143
className={props.isThemeLight ? classes.themeLight : classes.themeDark}
144+
// checkboxSelection
143145
/>
144146
</div>
145147
);

app/src/reducers/componentReducer.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -796,12 +796,23 @@ const reducer = (state: State, action: Action) => {
796796
components,
797797
state.canvasFocus.componentId
798798
);
799-
currComponent.passedInProps = action.payload.passedInProps;
800-
console.log('in delete reducer', currComponent)
801-
console.log('in delete reducer 2', action.payload.rowId)
802-
const toDelete = currComponent.passedInProps[0]
803-
console.log('in delete reducer', {toDelete})
804-
delete currComponent.passedInProps[0];
799+
console.log('currComponent.passedInProps before splice', currComponent.passedInProps)
800+
// currComponent.passedInProps = action.payload.passedInProps;
801+
// console.log('in delete reducer after assignment', currComponent.passedInProps)
802+
console.log('in delete reducer action.payload.rowId', action.payload.rowId)
803+
// const toDelete = currComponent.passedInProps[action.payload.rowId]
804+
// console.log('in delete reducer toDelete', {toDelete})
805+
let index;
806+
for (let i = 0; i < currComponent.passedInProps.length - 1 ; i++) {
807+
if (currComponent.passedInProps[i].id === action.payload.rowId) {
808+
index = i;
809+
break;
810+
}
811+
}
812+
currComponent.passedInProps.splice(index, 1);
813+
// console.log('temp', temp)
814+
console.log('currComponent.passedInProps after splice', currComponent.passedInProps)
815+
// delete currComponent.passedInProps[0];
805816
currComponent.code = generateCode(
806817
components,
807818
state.canvasFocus.componentId,

0 commit comments

Comments
 (0)