From 773be62c46e7b80d173e62bba9255fce5782f5ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Nam=20Long?= Date: Wed, 10 Jun 2026 22:22:21 +0700 Subject: [PATCH] fix(datagrid): cancel in-progress query before refresh so Cmd+R always runs currentQueryTask?.cancel() is async; runQuery() bails on isExecuting == true. Fix: nil the task and reset isExecuting synchronously before rebuildTableQuery + runQuery. --- CHANGELOG.md | 1 + .../Main/Extensions/MainContentCoordinator+Refresh.swift | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32625cb83..5c29f7126 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Pressing Cmd+R to refresh while a query is executing now cancels the running query and starts a fresh one instead of silently doing nothing. - iCloud Sync between the iPhone and Mac apps: the iOS app now uses the Production CloudKit environment, so a development build no longer syncs into a separate database the Mac never reads. - Exports no longer fail mid-table on servers that enforce a statement time limit; the export session disables the limit and restores it afterwards, the same way mysqldump does. (#1633) diff --git a/TablePro/Views/Main/Extensions/MainContentCoordinator+Refresh.swift b/TablePro/Views/Main/Extensions/MainContentCoordinator+Refresh.swift index 4abdbcd70..146a83ce4 100644 --- a/TablePro/Views/Main/Extensions/MainContentCoordinator+Refresh.swift +++ b/TablePro/Views/Main/Extensions/MainContentCoordinator+Refresh.swift @@ -34,6 +34,8 @@ extension MainContentCoordinator { if let (tab, tabIndex) = tabManager.selectedTabAndIndex, tab.tabType == .table { currentQueryTask?.cancel() + currentQueryTask = nil + tabManager.mutate(at: tabIndex) { $0.execution.isExecuting = false } rebuildTableQuery(at: tabIndex) runQuery() } @@ -43,6 +45,8 @@ extension MainContentCoordinator { if let (tab, tabIndex) = tabManager.selectedTabAndIndex, tab.tabType == .table { currentQueryTask?.cancel() + currentQueryTask = nil + tabManager.mutate(at: tabIndex) { $0.execution.isExecuting = false } rebuildTableQuery(at: tabIndex) runQuery() }