Skip to content

Commit 076e477

Browse files
authored
fix(SQLPopover): Use correct component (#35212)
1 parent 1e4bc6e commit 076e477

File tree

1 file changed

+6
-19
lines changed
  • superset-frontend/packages/superset-ui-chart-controls/src/components

1 file changed

+6
-19
lines changed

superset-frontend/packages/superset-ui-chart-controls/src/components/SQLPopover.tsx

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19-
import { useEffect, useState } from 'react';
20-
import { Popover, type PopoverProps } from '@superset-ui/core/components';
21-
import type ReactAce from 'react-ace';
19+
import {
20+
Popover,
21+
type PopoverProps,
22+
SQLEditor,
23+
} from '@superset-ui/core/components';
2224
import { CalculatorOutlined } from '@ant-design/icons';
2325
import { css, styled, useTheme, t } from '@superset-ui/core';
2426

@@ -35,24 +37,10 @@ const StyledCalculatorIcon = styled(CalculatorOutlined)`
3537

3638
export const SQLPopover = (props: PopoverProps & { sqlExpression: string }) => {
3739
const theme = useTheme();
38-
const [AceEditor, setAceEditor] = useState<typeof ReactAce | null>(null);
39-
useEffect(() => {
40-
Promise.all([
41-
import('react-ace'),
42-
import('ace-builds/src-min-noconflict/mode-sql'),
43-
]).then(([reactAceModule]) => {
44-
setAceEditor(() => reactAceModule.default);
45-
});
46-
}, []);
47-
48-
if (!AceEditor) {
49-
return null;
50-
}
5140
return (
5241
<Popover
5342
content={
54-
<AceEditor
55-
mode="sql"
43+
<SQLEditor
5644
value={props.sqlExpression}
5745
editorProps={{ $blockScrolling: true }}
5846
setOptions={{
@@ -65,7 +53,6 @@ export const SQLPopover = (props: PopoverProps & { sqlExpression: string }) => {
6553
wrapEnabled
6654
style={{
6755
border: `1px solid ${theme.colorBorder}`,
68-
background: theme.colorPrimaryBg,
6956
maxWidth: theme.sizeUnit * 100,
7057
}}
7158
/>

0 commit comments

Comments
 (0)