Skip to content

Fix Cancel button stuck visible after job manager refresh - #600

Merged
buzzia2001 merged 1 commit into
codefori:mainfrom
benetti-marco:fix/cancel-button-stuck-on-refresh
Nov 25, 2026
Merged

buzzia2001 merged 1 commit into
codefori:mainfrom
benetti-marco:fix/cancel-button-stuck-on-refresh

Conversation

@benetti-marco

Copy link
Copy Markdown
Contributor

Problem

When a workspace is opened with .sql files already open, the SQL editor title bar can show the Cancel button (vscode-db2i.statement.cancel) even though nothing is running. While it is showing, the Run button is hidden and "Check SQL syntax" is disabled, because the vscode-db2i:statementCanCancel context key stays true. Running any statement clears it, because the button is turned off when the statement finishes.

Cause

JobManagerView.refresh() calls updateStatusBar() without awaiting it. To build the tooltip, updateStatusBar() immediately sends queries on the selected job: the current schema, and pending transactions when the job is under commit control. In mapepire-js, SQLJob.send() sets the job status to busy synchronously. So when refresh() then calls getStatus(), it gets "busy" and shows the Cancel button. When the queries finish, the job goes back to ready, but nothing recalculates the context key.

On main this happens with SQL naming (the first time only, because the current schema is cached after that) or when commit control is on. With #585, the status bar also fetches the library list or current path, and it calls getCurrentSchema on every new job, so the button gets stuck on every startup with either naming.

Fix

Read the job status and set the Cancel button visibility before calling updateStatusBar(), so the queries the status bar sends no longer affect it.

Testing

  • Open a workspace with .sql files already open, connect, and check that the Run button shows and the Cancel button doesn't

…resh

updateStatusBar sends queries on the selected job (current schema, pending
transactions, library list) without being awaited. SQLJob.send() marks the
job as busy synchronously, so refresh() read a busy status and showed the
Cancel button, which was never hidden once the queries completed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@buzzia2001 buzzia2001 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works fine, thank you

@buzzia2001
buzzia2001 merged commit cf31636 into codefori:main Nov 25, 2026
1 check passed
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.

2 participants