fix(sqllab): inactive leftbar selector on empty state (#38833)

(cherry picked from commit cfa1aba1e0)
This commit is contained in:
JUST.in DO IT
2026-03-26 08:57:16 -07:00
committed by Michael S. Molina
parent 686fa44a5f
commit bd552209e7
7 changed files with 94 additions and 28 deletions

View File

@@ -21,6 +21,8 @@ import { useMemo } from 'react';
import { shallowEqual, useSelector } from 'react-redux';
import { SqlLabRootState, QueryEditor } from 'src/SqlLab/types';
export const EMPTY_STATE_QE_ID = 'tmp_qe_id';
export default function useQueryEditor<T extends keyof QueryEditor>(
sqlEditorId: string,
attributes: ReadonlyArray<T>,
@@ -43,6 +45,7 @@ export default function useQueryEditor<T extends keyof QueryEditor>(
{
...queryEditors[queryEditorsById[sqlEditorId]],
...(sqlEditorId === unsavedQueryEditor?.id && unsavedQueryEditor),
...(sqlEditorId === EMPTY_STATE_QE_ID && { id: sqlEditorId }),
},
['id'].concat(attributes),
) as Pick<QueryEditor, T | 'id'>,