Skip to content

Commit f63c5f8

Browse files
committed
refactor: check for inserted rows logic
1 parent b19278b commit f63c5f8

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

components/results_table.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,20 +1375,21 @@ func (table *ResultsTable) UpdateSidebar() {
13751375

13761376
func (table *ResultsTable) isAnInsertedRow(rowIndex int) (isAnInsertedRow bool, DBChangeIndex int) {
13771377
for i, dmlChange := range *table.state.listOfDBChanges {
1378-
values := dmlChange.Values
1379-
1380-
for _, value := range values {
1381-
if value.TableRowIndex == rowIndex {
1382-
cellReference := table.GetCell(rowIndex, 0).GetReference()
1383-
1384-
isAnInsertedRow := cellReference != nil && cellReference.(string) != "NULL&" && cellReference.(string) != "EMPTY&" && cellReference.(string) != "DEFAULT&"
1385-
1386-
if isAnInsertedRow {
1387-
return true, i
1388-
}
1378+
for _, value := range dmlChange.Values {
1379+
if value.TableRowIndex != rowIndex {
1380+
continue
13891381
}
1382+
cellReference := table.GetCell(rowIndex, 0).GetReference()
1383+
if cellReference == nil {
1384+
break
1385+
}
1386+
switch cellReference.(string) {
1387+
case "NULL&", "EMPTY&", "DEFAULT&":
1388+
default:
1389+
return true, i
1390+
}
1391+
break
13901392
}
1391-
13921393
}
13931394
return false, -1
13941395
}

0 commit comments

Comments
 (0)