Skip to content

Commit

Permalink
fix linting errors in graph (#50907) (#52070)
Browse files Browse the repository at this point in the history
  • Loading branch information
flash1293 authored Dec 3, 2019
1 parent db474c4 commit e024485
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
6 changes: 0 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,6 @@ module.exports = {
'jsx-a11y/click-events-have-key-events': 'off',
},
},
{
files: ['x-pack/legacy/plugins/graph/**/*.{js,ts,tsx}'],
rules: {
'react-hooks/exhaustive-deps': 'off',
},
},
{
files: ['x-pack/legacy/plugins/index_management/**/*.{js,ts,tsx}'],
rules: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ export function FieldEditor({
if (currentField !== initialField) {
setCurrentField(initialField);
}
// this hook only updates on change of the prop
// it's meant to reset the internal state on changes outside of the component.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [initialField]);

function updateField() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ export function FieldPicker({
// only update the field options if the popover is not open currently.
// This is necessary because EuiSelectable assumes options don't change
// on their own.
setFieldOptions(toOptions(allFields));
setFieldOptions(toOptions(Object.values(fieldMap)));
}
}, [fieldMap]);
}, [fieldMap, open]);

const badgeDescription = i18n.translate('xpack.graph.bar.pickFieldsLabel', {
defaultMessage: 'Add fields',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export function SearchBarComponent(props: SearchBarProps) {
}
}
fetchPattern();
}, [currentDatasource]);
}, [currentDatasource, indexPatternProvider]);

const kibana = useKibana<IDataPluginServices>();
const { services, overlays } = kibana;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,17 @@ export function UrlTemplateForm(props: UrlTemplateFormProps) {

const [currentTemplate, setCurrentTemplate] = useState(getInitialTemplate);

const persistedTemplateState = isUpdateForm(props) && props.initialTemplate;

// reset local form if template passed in from parent component changes
useEffect(() => {
if (isUpdateForm(props) && currentTemplate !== props.initialTemplate) {
setCurrentTemplate(props.initialTemplate);
}
}, [isUpdateForm(props) && props.initialTemplate]);
// this hook only updates on change of the prop
// it's meant to reset the internal state on changes outside of the component.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [persistedTemplateState]);

const [touched, setTouched] = useState({
description: false,
Expand Down

0 comments on commit e024485

Please sign in to comment.