Skip to content

Creating a query from Data Browser unexpectedly switches the sidebar to Files #1915

Description

@openai0229

Chat2DB Edition

Chat2DB Community

Chat2DB Version

Source build: f5d2a7c

Deployment

Desktop

Operating System

macOS

Operating System Version

27.0

Database and Version

N/A - this is a database-independent UI navigation issue.

Problem Summary

Creating a query from a database or schema context menu unexpectedly switches the left sidebar from Data Browser to Files. This removes the database context from view immediately after the query is created.

Steps to Reproduce

  1. Open Chat2DB Desktop and select Data Browser.
  2. Expand a datasource and select a database or schema.
  3. Right-click the node and choose "New Query".
  4. Wait for the new SQL console to become active.
  5. Observe the active sidebar tab.

Expected Behavior

The new SQL console should open while Data Browser remains active. The selected database node, expansion state, and scroll position should be preserved.

When "Auto-follow current tab" is enabled, a database-backed SQL console should be located in Data Browser. Opening an actual local SQL file should continue to switch to Files.

Actual Behavior

The SQL console opens, but the sidebar switches to Files and displays the local workspace tree. The user must manually return to Data Browser.

Logs

N/A - no error is displayed.

Screenshots or Additional Context

N/A

Impact

Degrades a core workflow

Workaround

A reliable workaround exists

Submission Checklist

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

Maintainer Ready Contract

  • User outcome: Creating a database-backed query keeps Data Browser visible and preserves its current tree context; opening a real local SQL file still selects Files.
  • In scope:
    • Trace the workspace-tab metadata created by the database/schema New Query action.
    • Preserve the datasource/database/schema context needed by getActiveTabLocateTarget.
    • Add a focused regression test for database-backed console tabs and local SQL file tabs.
    • Add the exact frontend test command to package.json and Community CI.
  • Non-goals:
    • Redesigning the workspace sidebar or tab layout.
    • Changing manual panel selection while Auto-follow current tab is disabled.
    • Changing how local SQL files are revealed in Files.
  • Suggested code or documentation area:
    • chat2db-community-client/src/pages/main/workspace/utils/activeTabLocator.ts
    • chat2db-community-client/src/pages/main/workspace/components/WorkspaceLeft/index.tsx
    • The context-menu query creation path that constructs the WorkspaceTabType.CONSOLE tab.
  • Acceptance criteria:
    • A console created from a datasource, database, or schema resolves to surface: 'databaseTree'.
    • Activating that console does not select Files.
    • A WorkspaceTabType.LocalSQLFile tab still resolves to surface: 'localFile'.
    • Auto-follow off preserves the user's current sidebar panel.
    • The regression is covered by a deterministic TypeScript test with no desktop bridge.
  • Exact verification:
    • yarn run test:active-tab-locator
    • yarn lint:eslint
    • yarn run build:web:community --app_version=5.3.0
  • Dependencies or required environment: Node.js 22.22.2 and Yarn 1.x. No database or JCEF runtime should be required for the automated test.
  • Review maintainer: @openai0229
  • First substantive review target: 5 business days
  • Milestone: Not release-committed

Activity

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

Metadata

Metadata

Assignees

Labels

area/database-treeDatabase tree, metadata, and object navigationarea/frontendOwnership: Community frontend components and UI codeedition/communityChat2DB Community

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions