Skip to content

Commit b217d63

Browse files
committed
fix: address CodeRabbit review comments
1 parent 4e14162 commit b217d63

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

TablePro/Views/Main/Extensions/MainContentCoordinator+LazyLoadColumns.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ private enum LazyLoadLog {
1313
static let logger = Logger(subsystem: "com.TablePro", category: "LazyLoadColumns")
1414
}
1515

16-
extension MainContentCoordinator {
16+
internal extension MainContentCoordinator {
1717
func fetchFullValuesForExcludedColumns(
1818
tableName: String,
1919
primaryKeyColumn: String,
@@ -40,7 +40,7 @@ extension MainContentCoordinator {
4040
placeholder = "?"
4141
}
4242

43-
let query = "SELECT \(quotedCols.joined(separator: ", ")) FROM \(quotedTable) WHERE \(quotedPK) = \(placeholder) LIMIT 1"
43+
let query = "SELECT \(quotedCols.joined(separator: ", ")) FROM \(quotedTable) WHERE \(quotedPK) = \(placeholder)"
4444

4545
LazyLoadLog.logger.debug("Lazy-loading excluded columns: \(excludedColumnNames.joined(separator: ", "), privacy: .public)")
4646

TablePro/Views/Main/MainContentView.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,9 @@ struct MainContentView: View {
949949
capturedEditState.selectedRowIndices.first == expectedRowIndex else { return }
950950
capturedEditState.applyFullValues(fullValues)
951951
} catch {
952-
guard !Task.isCancelled else { return }
952+
guard !Task.isCancelled,
953+
capturedEditState.selectedRowIndices.count == 1,
954+
capturedEditState.selectedRowIndices.first == expectedRowIndex else { return }
953955
for i in 0..<capturedEditState.fields.count where capturedEditState.fields[i].isLoadingFullValue {
954956
capturedEditState.fields[i].isLoadingFullValue = false
955957
}

0 commit comments

Comments
 (0)