Skip to content

Query Editor: Preserve query mode selection when switching between tabs #3591

@KlementMultiverse

Description

@KlementMultiverse

Problem

When a user selects a query mode (YQL or PostgreSQL) in the Query Editor and then switches to another tab (History, Saved Queries, Results), returning to the Query Editor resets the mode back to the default. This forces users to re-select their preferred mode repeatedly, breaking workflow continuity.

Why this matters

Developers working with PostgreSQL-syntax queries need to stay in PostgreSQL mode across multiple editing sessions. The current behavior creates friction, especially when:

  • Debugging multi-statement workflows that require switching between query history and editing
  • Comparing results across different query versions (jumping between Results and Query tabs)
  • Working with saved PostgreSQL queries that must be edited and re-run

Current behavior

  1. User selects "PostgreSQL" mode in Query Editor
  2. User clicks "History" tab to review past queries
  3. User clicks back to "Query" tab
  4. Mode has reset to "YQL" (the default)

Expected behavior

The selected query mode should persist in Redux state and be restored when the Query Editor tab regains focus, matching the pattern already used for other editor state (e.g., query content is preserved).

Technical context

The Query Editor's mode selector is in the src/components/QueryEditor/ directory. Currently, the mode selection appears to be local component state rather than Redux state. Compare this to:

  • How savedPath is preserved in QueryEditor (line ~120 in the component)
  • How the query content itself persists across tab switches

The fix likely involves:

  1. Moving query mode from component state to Redux (similar to executeQuery reducer)
  2. Dispatching the mode selection to the store when it changes
  3. Reading the persisted mode from Redux on component mount

Related

This is distinct from #917 (onboarding) and complements the mode UX improvements made in recent releases where data/query modes were separated.


Contributed by Klement Gunndu

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions