Skip to content

Commit cb77dad

Browse files
davemarcohoophalab
andauthored
Apply suggestions from code review
Co-authored-by: hoophalab <[email protected]>
1 parent 76248cd commit cb77dad

File tree

1 file changed

+5
-7
lines changed
  • components/webui/client/src/components/SqlInput

1 file changed

+5
-7
lines changed

components/webui/client/src/components/SqlInput/index.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type SqlInputProps = SqlEditorProps & {
2929
*/
3030
const SqlInput = (props: SqlInputProps) => {
3131
const {validateFn, ...editorProps} = props;
32-
const editorRef = useRef<SqlEditorType | null>(null);
32+
const editorRef = useRef<Nullable<SqlEditorType>>(null);
3333

3434
const handleEditorReady = useCallback((editor: SqlEditorType) => {
3535
editorRef.current = editor;
@@ -62,21 +62,19 @@ const SqlInput = (props: SqlInputProps) => {
6262
// Validate SQL and update markers whenever value changes
6363
useEffect(() => {
6464
const editor = editorRef.current;
65-
if (!editor) {
65+
if (null === editor) {
6666
return;
6767
}
6868

6969
const model = editor.getModel();
70-
if (!model) {
70+
if (null === model) {
7171
return;
7272
}
7373

74-
const value = "string" === typeof editorProps.value ?
75-
editorProps.value :
76-
"";
74+
const value = editorProps.value ?? "";
7775

7876
// Clear markers if no validation function or empty/whitespace-only input
79-
if (!validateFn || !value.trim()) {
77+
if ("undefined" === typeof validateFn || "" === value.trim()) {
8078
monaco.editor.setModelMarkers(model, "sql-parser", []);
8179

8280
return;

0 commit comments

Comments
 (0)