Skip to content

Commit

Permalink
feat(frontend): improve attribute selection in test outputs form (#2942)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgeepc committed Jul 14, 2023
1 parent f6d5211 commit 20b9567
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions web/src/components/TestOutputForm/TestOutputForm.tsx
@@ -1,4 +1,7 @@
import {startCompletion} from '@codemirror/autocomplete';
import {EditorView} from '@codemirror/view';
import {Button, Form, Input, Tag} from 'antd';
import {delay} from 'lodash';
import {useEffect} from 'react';

import Editor from 'components/Editor';
Expand Down Expand Up @@ -57,6 +60,10 @@ const TestOutputForm = ({
};
}, []);

Check warning on line 61 in web/src/components/TestOutputForm/TestOutputForm.tsx

View workflow job for this annotation

GitHub Actions / WebUI unit tests

React Hook useEffect has a missing dependency: 'onCancel'. Either include it or remove the dependency array. If 'onCancel' changes too often, find the parent component that defines it and wrap that definition in useCallback

const onAttributeFocus = (view: EditorView) => {
if (!view?.state.doc.length) delay(() => startCompletion(view!), 0);
};

return (
<S.Container>
<S.Title>{isEditing ? 'Edit Test Output' : 'Add Test Output'}</S.Title>
Expand Down Expand Up @@ -105,6 +112,7 @@ const TestOutputForm = ({
}}
placeholder="Attribute"
type={SupportedEditors.Expression}
onFocus={onAttributeFocus}
/>
</Form.Item>
</S.FormSection>
Expand Down

0 comments on commit 20b9567

Please sign in to comment.