Skip to content

fix(datagrid): cancel in-progress query before Cmd+R refresh#1650

Open
J2TeamNNL wants to merge 1 commit into
TableProApp:mainfrom
J2TeamNNL:fix/datagrid-d14-refresh
Open

fix(datagrid): cancel in-progress query before Cmd+R refresh#1650
J2TeamNNL wants to merge 1 commit into
TableProApp:mainfrom
J2TeamNNL:fix/datagrid-d14-refresh

Conversation

@J2TeamNNL

Copy link
Copy Markdown
Contributor

Root cause

currentQueryTask?.cancel() initiates cooperative cancellation but does not synchronously reset tab.execution.isExecuting. The subsequent runQuery() call hits guard !tab.execution.isExecuting else { return } and silently bails, so the refresh never executes when a query is running.

Fix

After currentQueryTask?.cancel(), immediately set currentQueryTask = nil and reset tab.execution.isExecuting = false before calling rebuildTableQuery + runQuery. Applied to both the discard-confirmation branch and the no-pending-changes branch of handleRefresh.

File: TablePro/Views/Main/Extensions/MainContentCoordinator+Refresh.swift

Test plan

  • Open a table, start a slow query, press Cmd+R before it finishes — query cancels, fresh result loads
  • Same scenario with unsaved edits: confirm discard, then Cmd+R produces fresh results

…s runs

currentQueryTask?.cancel() is async; runQuery() bails on isExecuting == true.
Fix: nil the task and reset isExecuting synchronously before rebuildTableQuery + runQuery.
@chatgpt-codex-connector

Copy link
Copy Markdown

💡 Codex Review


P2 Badge Call driver cancellation before restarting refresh

When Cmd+R is pressed while a table query is still running in the database driver, this clears currentQueryTask before runQuery() reaches executeQueryInternal. That method only calls driver.cancelQuery() inside if currentQueryTask != nil (TablePro/Views/Main/MainContentCoordinator.swift:1036-1043), so the backend query is never cancelled; it can keep occupying the connection and later unwind the cancelled task while the fresh query is already running. Keep the task reference long enough to invoke the existing cancellation path, or explicitly call cancelQuery() here before setting it to nil.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant