From e045a166448b5fbbcfcfe6a921c3c60c081669c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ng=C3=B4=20Qu=E1=BB=91c=20=C4=90=E1=BA=A1t?= Date: Wed, 29 Apr 2026 11:46:52 +0700 Subject: [PATCH] refactor(datagrid): consolidate resolvedTableRowsForTab into the existing helper resolvedTableRowsForTab(coordinator:tabId:) and resolvedTableRows(for:) returned the same one-liner: coordinator.tableRowsStore.existingTableRows(for: id) ?? TableRows(). The duplicate existed because the dataGridView closure captures [coordinator] and didn't have a QueryTab in scope. Inlined the store read directly in the closure (already a one-liner, no helper needed). Drops the duplicate method. resolvedTableRows(for tab:) stays for the four other call sites that operate on a QueryTab. --- TablePro/Views/Main/Child/MainEditorContentView.swift | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/TablePro/Views/Main/Child/MainEditorContentView.swift b/TablePro/Views/Main/Child/MainEditorContentView.swift index 01e3739af..6114d9b18 100644 --- a/TablePro/Views/Main/Child/MainEditorContentView.swift +++ b/TablePro/Views/Main/Child/MainEditorContentView.swift @@ -518,7 +518,7 @@ struct MainEditorContentView: View { let tabId = tab.id DataGridView( tableRowsProvider: { [coordinator] in - resolvedTableRowsForTab(coordinator: coordinator, tabId: tabId) + coordinator.tableRowsStore.existingTableRows(for: tabId) ?? TableRows() }, tableRowsMutator: { [coordinator] mutate in coordinator.mutateActiveTableRows(for: tabId) { rows in @@ -557,11 +557,6 @@ struct MainEditorContentView: View { coordinator.tableRowsStore.existingTableRows(for: tab.id) ?? TableRows() } - @MainActor - private func resolvedTableRowsForTab(coordinator: MainContentCoordinator, tabId: UUID) -> TableRows { - coordinator.tableRowsStore.existingTableRows(for: tabId) ?? TableRows() - } - private func displayFormats(for tab: QueryTab) -> [ValueDisplayFormat?] { let tableRows = coordinator.tableRowsStore.existingTableRows(for: tab.id) let columns = tableRows?.columns ?? []