Skip to content

SQL editor action buttons remain disabled after pasting content #2259

Description

@openai0229

Environment

Chat2DB Edition

Chat2DB Community

Chat2DB Version

Source build at 5ed077a5

Deployment

Web

Operating System

macOS

Operating System Version

macOS 27.0 (Build 26A5378n)

Database and Version

N/A - the issue is independent of the connected database.

Problem and Reproduction

Problem Summary

When SQL is pasted directly into an empty editor, the SQL text appears immediately but content-dependent toolbar actions can remain disabled. Typing another character causes the toolbar state to refresh.

Steps to Reproduce

  1. Start Chat2DB Community in Web mode.
  2. Open an empty SQL console.
  3. Paste a non-empty SQL statement directly into the Monaco editor.
  4. Observe the execute-current, explain, save, format, and optimize toolbar actions.

Expected Behavior

Content-dependent toolbar actions become enabled synchronously whenever the editor changes from empty or whitespace-only content to non-empty SQL, including paste, undo, redo, and programmatic edits.

Actual Behavior

The SQL appears in Monaco before the React hasEditorContent state is updated. The toolbar continues rendering its empty-editor disabled state until a later debounced content callback succeeds or another edit triggers synchronization.

Evidence

Logs

N/A - no runtime error is emitted.

Screenshots or Additional Context

The toolbar uses hasEditorContent while the existing Monaco content callback is debounced by 300 ms. UI state synchronization should be immediate; SQL parsing and completion work can remain debounced.

Impact and Workaround

Impact

Degrades a core workflow

Workaround

A partial workaround exists

Typing another character can trigger the toolbar state update.

Submission Checklist

  • I reproduced this on the selected Chat2DB edition.
  • I searched existing issues for duplicates.
  • I removed credentials and private data.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions