Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix linting errors in graph #50907

Merged
merged 2 commits into from
Dec 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Object.values is not supported in IE11. Is Graph expected to work with IE at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, all of Kibana should work in IE11. There are polyfills in place though for things like this.

}
}, [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