fix(sqllab): Skip AceEditor in inactive tabs (#30171)
This commit is contained in:
parent
6294e339e2
commit
4d1db9e32c
|
|
@ -189,6 +189,18 @@ describe('SqlEditor', () => {
|
|||
expect(await findByTestId('react-ace')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('skip rendering an AceEditorWrapper when the current tab is inactive', async () => {
|
||||
const { findByTestId, queryByTestId } = setup(
|
||||
{
|
||||
...mockedProps,
|
||||
queryEditor: initialState.sqlLab.queryEditors[1],
|
||||
},
|
||||
store,
|
||||
);
|
||||
expect(await findByTestId('mock-sql-editor-left-bar')).toBeInTheDocument();
|
||||
expect(queryByTestId('react-ace')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('avoids rerendering EditorLeftBar and ResultSet while typing', async () => {
|
||||
const { findByTestId } = setup(mockedProps, store);
|
||||
const editor = await findByTestId('react-ace');
|
||||
|
|
|
|||
|
|
@ -880,6 +880,7 @@ const SqlEditor: FC<Props> = ({
|
|||
startQuery={startQuery}
|
||||
/>
|
||||
)}
|
||||
{isActive && (
|
||||
<AceEditorWrapper
|
||||
autocomplete={autocompleteEnabled}
|
||||
onBlur={onSqlChanged}
|
||||
|
|
@ -889,6 +890,7 @@ const SqlEditor: FC<Props> = ({
|
|||
height={`${aceEditorHeight}px`}
|
||||
hotkeys={hotkeys}
|
||||
/>
|
||||
)}
|
||||
{renderEditorBottomBar(showEmptyState)}
|
||||
</div>
|
||||
<SouthPane
|
||||
|
|
|
|||
Loading…
Reference in New Issue