From 4236fd65be3ab0e223651359921dbd90b63a6311 Mon Sep 17 00:00:00 2001 From: James Gowdy Date: Thu, 1 Sep 2022 11:32:22 +0100 Subject: [PATCH 1/2] [ML] Removing global ml exhaustive-deps rule --- .eslintrc.js | 6 ------ x-pack/plugins/ml/public/alerting/job_selector.tsx | 3 +++ .../anomaly_detection_jobs_health_rule_trigger.tsx | 4 ++++ .../plugins/ml/public/alerting/ml_alerting_flyout.tsx | 2 ++ .../ml/public/alerting/ml_anomaly_alert_trigger.tsx | 9 +++++++++ .../ml/public/alerting/preview_alert_condition.tsx | 2 ++ .../ml/public/alerting/time_interval_control.tsx | 1 + .../components/annotations/annotation_flyout/index.tsx | 1 + .../components/anomalies_table/links_menu.tsx | 2 ++ .../anomaly_results_view_selector.tsx | 1 + .../components/chart_tooltip/chart_tooltip.tsx | 3 +++ .../color_range_legend/color_range_legend.tsx | 1 + .../checkbox_showcharts/checkbox_showcharts.tsx | 1 + .../components/custom_hooks/use_create_ad_links.ts | 1 + .../custom_selection_table/custom_selection_table.js | 3 +++ .../public/application/components/data_grid/common.ts | 1 + .../application/components/data_grid/data_grid.tsx | 1 + .../application/components/data_grid/use_data_grid.tsx | 2 ++ .../delete_space_aware_item_check_modal.tsx | 1 + .../full_time_range_selector.tsx | 2 ++ .../header_menu_portal/header_menu_portal.tsx | 1 + .../application/components/help_menu/help_menu.tsx | 1 + .../export_jobs_flyout/export_jobs_flyout.tsx | 4 ++++ .../import_jobs_flyout/import_jobs_flyout.tsx | 10 ++++++++++ .../import_export_jobs/import_jobs_flyout/validate.ts | 1 + .../components/job_selector/job_selector.tsx | 1 + .../components/job_selector/job_selector_flyout.tsx | 2 ++ .../components/job_selector/use_job_selection.ts | 3 +++ .../job_spaces_sync/job_spaces_sync_flyout.tsx | 1 + .../new_job_awaiting_node_shared.tsx | 4 ++++ .../components/ml_embedded_map/ml_embedded_map.tsx | 1 + .../public/application/components/ml_page/ml_page.tsx | 1 + .../public/application/components/ml_page/side_nav.tsx | 1 + .../ml_saved_objects_spaces_list.tsx | 2 ++ .../edit_model_snapshot_flyout.tsx | 3 +++ .../model_snapshots/model_snapshots_table.tsx | 3 +++ .../revert_model_snapshot_flyout/create_calendar.tsx | 5 +++++ .../revert_model_snapshot_flyout.tsx | 2 ++ .../date_picker_wrapper/date_picker_wrapper.tsx | 9 +++++++++ .../application/components/page_header/page_header.tsx | 1 + .../saved_objects_warning/saved_objects_warning.tsx | 2 ++ .../scatterplot_matrix/scatterplot_matrix.tsx | 2 ++ .../use_scatterplot_field_options.ts | 1 + .../components/vega_chart/vega_chart_view.tsx | 1 + .../application/contexts/kibana/use_cases_modal.ts | 1 + .../application/contexts/kibana/use_create_url.ts | 2 ++ .../contexts/kibana/use_navigate_to_path.ts | 1 + .../application/contexts/kibana/use_timefilter.ts | 1 + .../ml/public/application/contexts/ml/use_storage.ts | 1 + .../data_frame_analytics/common/analytics.ts | 1 + .../common/use_results_view_config.ts | 1 + .../components/advanced_step/advanced_step_form.tsx | 1 + .../configuration_step/analysis_fields_table.tsx | 1 + .../configuration_step/configuration_step_form.tsx | 9 +++++++++ .../configuration_step/supported_fields_message.tsx | 1 + .../components/configuration_step/use_saved_search.ts | 1 + .../create_analytics_advanced_editor.tsx | 2 ++ .../components/create_step/create_step.tsx | 1 + .../create_step_footer/create_step_footer.tsx | 1 + .../components/details_step/details_step_form.tsx | 4 ++++ .../components/runtime_mappings/runtime_mappings.tsx | 1 + .../validation_step/validation_step_wrapper.tsx | 1 + .../pages/analytics_creation/hooks/use_index_data.ts | 7 +++++++ .../pages/analytics_creation/page.tsx | 2 ++ .../classification_exploration/evaluate_panel.tsx | 1 + .../classification_exploration/use_confusion_matrix.ts | 1 + .../classification_exploration/use_roc_curve.ts | 1 + .../expandable_section_analytics.tsx | 1 + .../exploration_query_bar/exploration_query_bar.tsx | 2 ++ .../use_exploration_results.ts | 6 ++++++ .../use_classification_path_data.tsx | 1 + .../job_config_error_callout.tsx | 1 + .../components/outlier_exploration/use_outlier_data.ts | 5 +++++ .../regression_exploration/evaluate_panel.tsx | 1 + .../pages/analytics_exploration/page.tsx | 2 ++ .../components/action_clone/use_clone_action.tsx | 2 ++ .../components/action_delete/use_delete_action.tsx | 2 ++ .../components/action_map/use_map_action.tsx | 1 + .../components/action_start/use_start_action.tsx | 1 + .../components/action_stop/use_stop_action.tsx | 2 ++ .../components/action_view/use_view_action.tsx | 1 + .../components/analytics_list/analytics_list.tsx | 4 ++++ .../components/analytics_list/expanded_row.tsx | 1 + .../analytics_list/expanded_row_messages_pane.tsx | 2 ++ .../components/analytics_list/use_refresh_interval.ts | 1 + .../analytics_selector/analytics_id_selector.tsx | 2 ++ .../pages/job_map/components/controls.tsx | 3 +++ .../pages/job_map/components/cytoscape.tsx | 2 ++ .../data_frame_analytics/pages/job_map/job_map.tsx | 4 ++++ .../data_frame_analytics/pages/job_map/page.tsx | 1 + .../datavisualizer/file_based/file_datavisualizer.tsx | 2 ++ .../index_based/index_data_visualizer.tsx | 2 ++ .../application/explorer/actions/load_explorer_data.ts | 3 +++ .../ml/public/application/explorer/anomalies_map.tsx | 2 ++ .../application/explorer/anomaly_context_menu.tsx | 1 + .../application/explorer/anomaly_explorer_context.tsx | 3 +++ .../public/application/explorer/anomaly_timeline.tsx | 2 ++ .../add_swimlane_to_dashboard_controls.tsx | 1 + .../use_add_to_dashboard_actions.tsx | 1 + .../dashboard_controls/use_dashboards_table.tsx | 3 +++ .../ml/public/application/explorer/explorer.tsx | 5 +++++ .../explorer_charts/explorer_charts_container.js | 4 ++++ .../explorer/swimlane_annotation_container.tsx | 1 + .../public/application/explorer/swimlane_container.tsx | 4 ++++ .../application/explorer/swimlane_pagination.tsx | 2 ++ .../confirm_modals/close_jobs_confirm_modal.tsx | 1 + .../confirm_modals/stop_datafeeds_confirm_modal.tsx | 1 + .../datafeed_chart_flyout/datafeed_chart_flyout.tsx | 5 +++++ .../datafeed_chart_flyout/edit_query_delay.tsx | 1 + .../components/delete_job_modal/delete_job_modal.tsx | 2 ++ .../jobs/jobs_list/components/job_actions/results.js | 2 ++ .../components/job_details/job_messages_pane.tsx | 3 +++ .../components/job_filter_bar/job_filter_bar.tsx | 3 +++ .../components/reset_job_modal/reset_job_modal.tsx | 2 ++ .../time_range_selector/time_range_selector.js | 1 + .../new_job/common/components/time_range_picker.tsx | 2 ++ .../common/job_creator/util/model_memory_estimator.ts | 3 +++ .../datafeed_preview_flyout/datafeed_preview.tsx | 2 ++ .../edit_categorization_analyzer_flyout.tsx | 1 + .../common/json_editor_flyout/json_editor_flyout.tsx | 2 ++ .../model_memory_limit/model_memory_limit_input.tsx | 3 +++ .../components/data_view/change_data_view.tsx | 1 + .../components/frequency/frequency_input.tsx | 3 +++ .../datafeed_step/components/query/query_input.tsx | 3 +++ .../components/query_delay/query_delay_input.tsx | 3 +++ .../components/scroll_size/scroll_size_input.tsx | 3 +++ .../datafeed_step/components/time_field/time_field.tsx | 2 ++ .../pages/components/datafeed_step/datafeed.tsx | 1 + .../components/calendars/calendars_selection.tsx | 2 ++ .../components/annotations/annotations_switch.tsx | 2 ++ .../dedicated_index/dedicated_index_switch.tsx | 1 + .../advanced_section/components/mml_callout.tsx | 1 + .../components/model_plot/model_plot_switch.tsx | 2 ++ .../components/groups/groups_input.tsx | 2 ++ .../job_description/job_description_input.tsx | 1 + .../components/job_id/job_id_input.tsx | 2 ++ .../pages/components/job_details_step/job_details.tsx | 1 + .../advanced_detector_modal.tsx | 2 ++ .../components/advanced_view/advanced_view.tsx | 1 + .../components/advanced_view/detector_list.tsx | 2 ++ .../components/advanced_view/metric_selection.tsx | 1 + .../components/agg_select/agg_select.tsx | 1 + .../components/bucket_span/bucket_span.tsx | 4 ++++ .../bucket_span_estimator/bucket_span_estimator.tsx | 2 ++ .../pick_fields_step/components/by_field/by_field.tsx | 5 +++++ .../categorization_detector.tsx | 2 ++ .../categorization_field/categorization_field.tsx | 2 ++ .../categorization_field_select.tsx | 1 + .../categorization_per_partition.tsx | 1 + .../categorization_per_partition_dropdown.tsx | 3 +++ .../categorization_per_partition_input.tsx | 1 + .../categorization_per_partition_switch.tsx | 2 ++ .../categorization_stop_on_warn_switch.tsx | 2 ++ .../categorization_view/categorization_view.tsx | 1 + .../category_stopped_partitions.tsx | 1 + .../categorization_view/metric_selection.tsx | 3 +++ .../categorization_view/metric_selection_summary.tsx | 1 + .../components/categorization_view/top_categories.tsx | 1 + .../components/influencers/influencers.tsx | 2 ++ .../components/multi_metric_view/metric_selection.tsx | 5 +++++ .../multi_metric_view/metric_selection_summary.tsx | 2 ++ .../components/multi_metric_view/multi_metric_view.tsx | 1 + .../components/population_field/population_field.tsx | 5 +++++ .../components/population_view/metric_selection.tsx | 5 +++++ .../population_view/metric_selection_summary.tsx | 3 +++ .../components/population_view/population_view.tsx | 1 + .../components/rare_detector/rare_detector.tsx | 2 ++ .../components/rare_field/rare_field.tsx | 5 +++++ .../components/rare_view/detector_description.tsx | 1 + .../components/rare_view/metric_selection.tsx | 1 + .../components/rare_view/metric_selection_summary.tsx | 2 ++ .../components/rare_view/rare_view.tsx | 1 + .../components/single_metric_view/metric_selection.tsx | 3 +++ .../single_metric_view/metric_selection_summary.tsx | 1 + .../single_metric_view/single_metric_view.tsx | 1 + .../components/sparse_data/sparse_data_switch.tsx | 2 ++ .../components/split_field/split_field.tsx | 5 +++++ .../summary_count_field/summary_count_field.tsx | 3 +++ .../pages/components/pick_fields_step/pick_fields.tsx | 1 + .../new_job/pages/components/summary_step/summary.tsx | 2 ++ .../pages/components/time_range_step/time_range.tsx | 2 ++ .../pages/components/validation_step/validation.tsx | 1 + .../application/jobs/new_job/pages/new_job/page.tsx | 3 +++ .../application/jobs/new_job/pages/new_job/wizard.tsx | 4 ++++ .../jobs/new_job/recognize/components/edit_job.tsx | 1 + .../new_job/recognize/components/job_settings_form.tsx | 2 ++ .../public/application/jobs/new_job/recognize/page.tsx | 1 + .../components/jobs_list_page/jobs_list_page.tsx | 2 ++ .../space_management/space_management.tsx | 2 ++ .../components/analytics_panel/analytics_panel.tsx | 1 + .../anomaly_detection_panel.tsx | 1 + .../plugins/ml/public/application/routing/router.tsx | 1 + .../ml/public/application/routing/routes/explorer.tsx | 5 +++++ .../ml/public/application/routing/routes/jobs_list.tsx | 1 + .../application/routing/routes/timeseriesexplorer.tsx | 5 +++++ .../ml/public/application/routing/use_active_route.tsx | 2 ++ .../ml/public/application/routing/use_refresh.ts | 1 + .../ml/public/application/routing/use_resolver.ts | 1 + .../toast_notification_service.ts | 1 + .../settings/anomaly_detection_settings.tsx | 1 + .../components/entity_control/entity_config.tsx | 1 + .../plot_function_controls/plot_function_controls.tsx | 1 + .../components/series_controls/series_controls.tsx | 1 + .../timeseries_chart/timeseries_chart_with_tooltip.tsx | 2 ++ .../models_management/delete_models_modal.tsx | 1 + .../trained_models/models_management/expanded_row.tsx | 2 ++ .../trained_models/models_management/models_list.tsx | 4 ++++ .../test_models/models/inference_input_form.tsx | 3 +++ .../question_answering/question_answering_input.tsx | 1 + .../models/text_classification/fill_mask_output.tsx | 1 + .../zero_shot_classification_input.tsx | 1 + .../test_models/models/text_input.tsx | 1 + .../nodes_overview/memory_preview_chart.tsx | 1 + .../trained_models/nodes_overview/nodes_list.tsx | 2 ++ .../plugins/ml/public/application/util/url_state.tsx | 3 +++ .../embeddable_anomaly_charts_container.tsx | 3 +++ .../use_anomaly_charts_input_resolver.ts | 4 ++++ .../embeddable_swim_lane_container.tsx | 2 ++ .../anomaly_swimlane/swimlane_input_resolver.ts | 9 +++++++++ .../common/use_embeddable_execution_context.ts | 1 + .../lens/lens_vis_layer_selection_flyout/flyout.tsx | 1 + .../layer/compatible_layer.tsx | 1 + 222 files changed, 471 insertions(+), 6 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index caa408887c499..b73b88ba95de9 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -287,12 +287,6 @@ module.exports = { 'jsx-a11y/click-events-have-key-events': 'off', }, }, - { - files: ['x-pack/plugins/ml/**/*.{js,mjs,ts,tsx}'], - rules: { - 'react-hooks/exhaustive-deps': 'off', - }, - }, /** * Files that require dual-license headers, settings diff --git a/x-pack/plugins/ml/public/alerting/job_selector.tsx b/x-pack/plugins/ml/public/alerting/job_selector.tsx index 3ba9a7c1ff838..2a4791a29e576 100644 --- a/x-pack/plugins/ml/public/alerting/job_selector.tsx +++ b/x-pack/plugins/ml/public/alerting/job_selector.tsx @@ -111,8 +111,10 @@ export const JobSelectorControl: FC = ({ } catch (e) { // TODO add error handling } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [adJobsApiService]); + // eslint-disable-next-line react-hooks/exhaustive-deps const onSelectionChange: EuiComboBoxProps['onChange'] = useCallback( ((selectionUpdate) => { if (selectionUpdate.some((selectedOption) => selectedOption.value === ALL_JOBS_SELECTION)) { @@ -142,6 +144,7 @@ export const JobSelectorControl: FC = ({ useEffect(() => { if (defaultOptions) return; fetchOptions(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return ( diff --git a/x-pack/plugins/ml/public/alerting/jobs_health_rule/anomaly_detection_jobs_health_rule_trigger.tsx b/x-pack/plugins/ml/public/alerting/jobs_health_rule/anomaly_detection_jobs_health_rule_trigger.tsx index 1b88b38788554..9fff85c82888f 100644 --- a/x-pack/plugins/ml/public/alerting/jobs_health_rule/anomaly_detection_jobs_health_rule_trigger.tsx +++ b/x-pack/plugins/ml/public/alerting/jobs_health_rule/anomaly_detection_jobs_health_rule_trigger.tsx @@ -54,6 +54,7 @@ const AnomalyDetectionJobsHealthRuleTrigger: FC = ({ (update: MlAnomalyDetectionJobsHealthRuleParams[T]) => { setRuleParams(param, update); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [] ); @@ -119,6 +120,7 @@ const AnomalyDetectionJobsHealthRuleTrigger: FC = ({ = ({ } else { callback(null); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [])} errors={Array.isArray(errors.excludeJobs) ? errors.excludeJobs : []} multiSelect @@ -159,6 +162,7 @@ const AnomalyDetectionJobsHealthRuleTrigger: FC = ({ diff --git a/x-pack/plugins/ml/public/alerting/ml_alerting_flyout.tsx b/x-pack/plugins/ml/public/alerting/ml_alerting_flyout.tsx index 52707437d3bf9..9bebdfec957ab 100644 --- a/x-pack/plugins/ml/public/alerting/ml_alerting_flyout.tsx +++ b/x-pack/plugins/ml/public/alerting/ml_alerting_flyout.tsx @@ -79,6 +79,7 @@ export const MlAnomalyAlertFlyout: FC = ({ }, }); // deps on id to avoid re-rendering on auto-refresh + // eslint-disable-next-line react-hooks/exhaustive-deps }, [triggersActionsUi, initialAlert?.id, jobIds]); return <>{AlertFlyout}; @@ -114,6 +115,7 @@ export const JobListMlAnomalyAlertFlyout: FC = return () => { unsetShowFunction(); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return isVisible && jobIds ? ( diff --git a/x-pack/plugins/ml/public/alerting/ml_anomaly_alert_trigger.tsx b/x-pack/plugins/ml/public/alerting/ml_anomaly_alert_trigger.tsx index f025a2d4bd86d..a5ef1e7943438 100644 --- a/x-pack/plugins/ml/public/alerting/ml_anomaly_alert_trigger.tsx +++ b/x-pack/plugins/ml/public/alerting/ml_anomaly_alert_trigger.tsx @@ -59,6 +59,7 @@ const MlAnomalyAlertTrigger: FC = ({ (update: MlAnomalyDetectionAlertParams[T]) => { setRuleParams(param, update); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [] ); @@ -83,6 +84,7 @@ const MlAnomalyAlertTrigger: FC = ({ toastLifeTimeMs: 5000, }); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobsAndGroupIds]); const availableResultTypes = useMemo(() => { @@ -98,6 +100,7 @@ const MlAnomalyAlertTrigger: FC = ({ if (jobsAndGroupIds.length === 0) return; fetchJobsConfig(); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [jobsAndGroupIds] ); @@ -130,6 +133,7 @@ const MlAnomalyAlertTrigger: FC = ({ lookbackInterval, topNBuckets, }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ruleParams.lookbackInterval, ruleParams.topNBuckets, jobConfigs]); const resultParams = useMemo(() => { @@ -164,6 +168,7 @@ const MlAnomalyAlertTrigger: FC = ({ @@ -179,15 +184,18 @@ const MlAnomalyAlertTrigger: FC = ({ @@ -198,6 +206,7 @@ const MlAnomalyAlertTrigger: FC = ({ Object.keys(update).forEach((k) => { setRuleParams(k, update[k as keyof MlAnomalyDetectionAlertAdvancedSettings]); }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [])} /> diff --git a/x-pack/plugins/ml/public/alerting/preview_alert_condition.tsx b/x-pack/plugins/ml/public/alerting/preview_alert_condition.tsx index 951ce81fddbd1..78b76b38fae80 100644 --- a/x-pack/plugins/ml/public/alerting/preview_alert_condition.tsx +++ b/x-pack/plugins/ml/public/alerting/preview_alert_condition.tsx @@ -130,6 +130,7 @@ export const PreviewAlertCondition: FC = ({ [] ); + // eslint-disable-next-line react-hooks/exhaustive-deps const validationErrors = useMemo(() => validators(lookBehindInterval), [lookBehindInterval]); useEffect( @@ -153,6 +154,7 @@ export const PreviewAlertCondition: FC = ({ setPreviewResponse(undefined); setPreviewError(e.body ?? e); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [alertParams, lookBehindInterval]); const sampleHits = useMemo(() => { diff --git a/x-pack/plugins/ml/public/alerting/time_interval_control.tsx b/x-pack/plugins/ml/public/alerting/time_interval_control.tsx index 4ab73500958ae..98915e3565cfb 100644 --- a/x-pack/plugins/ml/public/alerting/time_interval_control.tsx +++ b/x-pack/plugins/ml/public/alerting/time_interval_control.tsx @@ -25,6 +25,7 @@ export const TimeIntervalControl: FC = ({ }) => { const validators = useMemo(() => composeValidators(timeIntervalInputValidator()), []); + // eslint-disable-next-line react-hooks/exhaustive-deps const validationErrors = useMemo(() => validators(value), [value]); const isInvalid = !!value && !!validationErrors; diff --git a/x-pack/plugins/ml/public/application/components/annotations/annotation_flyout/index.tsx b/x-pack/plugins/ml/public/application/components/annotations/annotation_flyout/index.tsx index bf2d41acd116b..5153f3267013c 100644 --- a/x-pack/plugins/ml/public/application/components/annotations/annotation_flyout/index.tsx +++ b/x-pack/plugins/ml/public/application/components/annotations/annotation_flyout/index.tsx @@ -439,6 +439,7 @@ export const AnnotationFlyout: FC = (props) => { const cancelEditingHandler = useCallback(() => { annotationUpdatesService.setValue(null); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); if (annotationProp === undefined || annotationProp === null) { diff --git a/x-pack/plugins/ml/public/application/components/anomalies_table/links_menu.tsx b/x-pack/plugins/ml/public/application/components/anomalies_table/links_menu.tsx index 773278074cb72..962b53f369e8e 100644 --- a/x-pack/plugins/ml/public/application/components/anomalies_table/links_menu.tsx +++ b/x-pack/plugins/ml/public/application/components/anomalies_table/links_menu.tsx @@ -211,6 +211,7 @@ export const LinksMenuUI = (props: LinksMenuProps) => { return () => { unmounted = true; }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [JSON.stringify(props.anomaly)]); const openCustomUrl = (customUrl: KibanaUrlConfig) => { @@ -684,6 +685,7 @@ export const LinksMenuUI = (props: LinksMenuProps) => { ); } return items; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ openInDiscoverUrl, discoverUrlError, diff --git a/x-pack/plugins/ml/public/application/components/anomaly_results_view_selector/anomaly_results_view_selector.tsx b/x-pack/plugins/ml/public/application/components/anomaly_results_view_selector/anomaly_results_view_selector.tsx index 3db87633b807c..d0111c5aed438 100644 --- a/x-pack/plugins/ml/public/application/components/anomaly_results_view_selector/anomaly_results_view_selector.tsx +++ b/x-pack/plugins/ml/public/application/components/anomaly_results_view_selector/anomaly_results_view_selector.tsx @@ -65,6 +65,7 @@ export const AnomalyResultsViewSelector: FC = ({ viewId, selectedJobs }) 'data-test-subj': 'mlAnomalyResultsViewSelectorExplorer', }, ], + // eslint-disable-next-line react-hooks/exhaustive-deps [isSingleMetricViewerDisabled, selectedJobs?.length] ); diff --git a/x-pack/plugins/ml/public/application/components/chart_tooltip/chart_tooltip.tsx b/x-pack/plugins/ml/public/application/components/chart_tooltip/chart_tooltip.tsx index b721608d53f7e..5ff5d478ffcf9 100644 --- a/x-pack/plugins/ml/public/application/components/chart_tooltip/chart_tooltip.tsx +++ b/x-pack/plugins/ml/public/application/components/chart_tooltip/chart_tooltip.tsx @@ -90,8 +90,10 @@ const Tooltip: FC<{ service: ChartTooltipService }> = React.memo(({ service }) = return () => { subscription.unsubscribe(); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); + // eslint-disable-next-line react-hooks/exhaustive-deps const triggerCallback = useCallback( (({ triggerRef }) => { // obtain the reference to the trigger setter callback @@ -103,6 +105,7 @@ const Tooltip: FC<{ service: ChartTooltipService }> = React.memo(({ service }) = [] ); + // eslint-disable-next-line react-hooks/exhaustive-deps const tooltipCallback = useCallback( (({ tooltipRef, getTooltipProps }) => { return ( diff --git a/x-pack/plugins/ml/public/application/components/color_range_legend/color_range_legend.tsx b/x-pack/plugins/ml/public/application/components/color_range_legend/color_range_legend.tsx index fb65af0472ddd..5f0c0a401bedd 100644 --- a/x-pack/plugins/ml/public/application/components/color_range_legend/color_range_legend.tsx +++ b/x-pack/plugins/ml/public/application/components/color_range_legend/color_range_legend.tsx @@ -128,6 +128,7 @@ export const ColorRangeLegend: FC = ({ if (!showTicks) { wrapper.selectAll('.axis line').style('display', 'none'); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [JSON.stringify(scale), d3Container.current]); if (title === undefined) { diff --git a/x-pack/plugins/ml/public/application/components/controls/checkbox_showcharts/checkbox_showcharts.tsx b/x-pack/plugins/ml/public/application/components/controls/checkbox_showcharts/checkbox_showcharts.tsx index bab6b6f132558..91cc0af5be61b 100644 --- a/x-pack/plugins/ml/public/application/components/controls/checkbox_showcharts/checkbox_showcharts.tsx +++ b/x-pack/plugins/ml/public/application/components/controls/checkbox_showcharts/checkbox_showcharts.tsx @@ -24,6 +24,7 @@ export const CheckboxShowCharts: FC = () => { const onChange = useCallback((e: React.ChangeEvent) => { chartsStateService.setShowCharts(e.target.checked); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const id = useMemo(() => htmlIdGenerator()(), []); diff --git a/x-pack/plugins/ml/public/application/components/custom_hooks/use_create_ad_links.ts b/x-pack/plugins/ml/public/application/components/custom_hooks/use_create_ad_links.ts index 3e051877fff77..1161b99a61e4b 100644 --- a/x-pack/plugins/ml/public/application/components/custom_hooks/use_create_ad_links.ts +++ b/x-pack/plugins/ml/public/application/components/custom_hooks/use_create_ad_links.ts @@ -33,6 +33,7 @@ export const useCreateADLinks = () => { ); return `${basePath.get()}/app/ml/${resultsUrl}`; }, + // eslint-disable-next-line react-hooks/exhaustive-deps [basePath] ); return { createLinkWithUserDefaults }; diff --git a/x-pack/plugins/ml/public/application/components/custom_selection_table/custom_selection_table.js b/x-pack/plugins/ml/public/application/components/custom_selection_table/custom_selection_table.js index 9062836bc32d2..a592fb571a03e 100644 --- a/x-pack/plugins/ml/public/application/components/custom_selection_table/custom_selection_table.js +++ b/x-pack/plugins/ml/public/application/components/custom_selection_table/custom_selection_table.js @@ -76,11 +76,13 @@ export function CustomSelectionTable({ useEffect(() => { setCurrentItems(items); handleQueryChange({ query: query }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [items]); // When changes to selected ids made via badge removal - update selection in the table accordingly useEffect(() => { setItemIdToSelectedMap(getCurrentlySelectedItemIdsMap()); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [selectedIds]); useEffect(() => { @@ -91,6 +93,7 @@ export function CustomSelectionTable({ lastItemIndex: tablePager.getLastItemIndex(), }); setPager(tablePager); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [currentItems]); function getCurrentlySelectedItemIdsMap() { diff --git a/x-pack/plugins/ml/public/application/components/data_grid/common.ts b/x-pack/plugins/ml/public/application/components/data_grid/common.ts index d65d041c9a204..15e3600d67fe3 100644 --- a/x-pack/plugins/ml/public/application/components/data_grid/common.ts +++ b/x-pack/plugins/ml/public/application/components/data_grid/common.ts @@ -404,6 +404,7 @@ export const useRenderCellValue = ( return cellValue; }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [indexPattern?.fields, pagination.pageIndex, pagination.pageSize, tableItems]); return renderCellValue; }; diff --git a/x-pack/plugins/ml/public/application/components/data_grid/data_grid.tsx b/x-pack/plugins/ml/public/application/components/data_grid/data_grid.tsx index 3edc757c11846..b2fceb58edfa4 100644 --- a/x-pack/plugins/ml/public/application/components/data_grid/data_grid.tsx +++ b/x-pack/plugins/ml/public/application/components/data_grid/data_grid.tsx @@ -176,6 +176,7 @@ export const DataGrid: FC = memo( return ; } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [baseline, data] ); diff --git a/x-pack/plugins/ml/public/application/components/data_grid/use_data_grid.tsx b/x-pack/plugins/ml/public/application/components/data_grid/use_data_grid.tsx index 55c12338b8fd4..331078d9ce671 100644 --- a/x-pack/plugins/ml/public/application/components/data_grid/use_data_grid.tsx +++ b/x-pack/plugins/ml/public/application/components/data_grid/use_data_grid.tsx @@ -80,6 +80,7 @@ export const useDataGrid = ( useEffect(() => { setVisibleColumns(defaultVisibleColumns); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [defaultVisibleColumns.join()]); const [invalidSortingColumnns, setInvalidSortingColumnns] = useState([]); @@ -137,6 +138,7 @@ export const useDataGrid = ( // If both columns are visible sort by their visible sorting order. return visibleColumns.indexOf(a.id) - visibleColumns.indexOf(b.id); }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [columns, columnCharts, chartsVisible, JSON.stringify(visibleColumns)]); // Initialize the mini histogram charts toggle button. diff --git a/x-pack/plugins/ml/public/application/components/delete_space_aware_item_check_modal/delete_space_aware_item_check_modal.tsx b/x-pack/plugins/ml/public/application/components/delete_space_aware_item_check_modal/delete_space_aware_item_check_modal.tsx index 882a351877071..4b576695c981a 100644 --- a/x-pack/plugins/ml/public/application/components/delete_space_aware_item_check_modal/delete_space_aware_item_check_modal.tsx +++ b/x-pack/plugins/ml/public/application/components/delete_space_aware_item_check_modal/delete_space_aware_item_check_modal.tsx @@ -278,6 +278,7 @@ export const DeleteSpaceAwareItemCheckModal: FC = ({ setDidUntag(false); } setIsLoading(false); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [hasManagedJob]); const onUntagClick = async () => { diff --git a/x-pack/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.tsx b/x-pack/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.tsx index 5b94a9fdc0763..e87c8c47df5a2 100644 --- a/x-pack/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.tsx +++ b/x-pack/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.tsx @@ -93,6 +93,7 @@ export const FullTimeRangeSelector: FC = ({ dataView, query, disabled, ca setFrozenDataPreference(id as FrozenTierPreference); setRange(dataView, query, id === FROZEN_TIER_PREFERENCE.EXCLUDE); closePopover(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const popoverContent = useMemo( @@ -106,6 +107,7 @@ export const FullTimeRangeSelector: FC = ({ dataView, query, disabled, ca /> ), + // eslint-disable-next-line react-hooks/exhaustive-deps [frozenDataPreference, sortOptions] ); diff --git a/x-pack/plugins/ml/public/application/components/header_menu_portal/header_menu_portal.tsx b/x-pack/plugins/ml/public/application/components/header_menu_portal/header_menu_portal.tsx index 66fa4f2869384..e3190e626a3bd 100644 --- a/x-pack/plugins/ml/public/application/components/header_menu_portal/header_menu_portal.tsx +++ b/x-pack/plugins/ml/public/application/components/header_menu_portal/header_menu_portal.tsx @@ -41,6 +41,7 @@ export const HeaderMenuPortal: FC = ({ children }) => { portalNode.unmount(); setHeaderActionMenu(undefined); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [portalNode, setHeaderActionMenu, services.theme.theme$]); return {children}; diff --git a/x-pack/plugins/ml/public/application/components/help_menu/help_menu.tsx b/x-pack/plugins/ml/public/application/components/help_menu/help_menu.tsx index 2362834508e7c..4d0c88036dad3 100644 --- a/x-pack/plugins/ml/public/application/components/help_menu/help_menu.tsx +++ b/x-pack/plugins/ml/public/application/components/help_menu/help_menu.tsx @@ -29,6 +29,7 @@ export const HelpMenu: FC = React.memo(({ docLink }) => { }, ], }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return null; diff --git a/x-pack/plugins/ml/public/application/components/import_export_jobs/export_jobs_flyout/export_jobs_flyout.tsx b/x-pack/plugins/ml/public/application/components/import_export_jobs/export_jobs_flyout/export_jobs_flyout.tsx index 43bc861f8f83a..4c53bbd1c4a17 100644 --- a/x-pack/plugins/ml/public/application/components/import_export_jobs/export_jobs_flyout/export_jobs_flyout.tsx +++ b/x-pack/plugins/ml/public/application/components/import_export_jobs/export_jobs_flyout/export_jobs_flyout.tsx @@ -52,6 +52,7 @@ export const ExportJobsFlyout: FC = ({ isDisabled, currentTab }) => { }, } = useMlKibana(); + // eslint-disable-next-line react-hooks/exhaustive-deps const jobsExportService = useMemo(() => new JobsExportService(mlApiServices), []); const [loadingADJobs, setLoadingADJobs] = useState(true); @@ -124,6 +125,7 @@ export const ExportJobsFlyout: FC = ({ isDisabled, currentTab }) => { }); } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [showFlyout] ); @@ -186,6 +188,7 @@ export const ExportJobsFlyout: FC = ({ isDisabled, currentTab }) => { switchTab(jobType); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [selectedJobIds] ); @@ -193,6 +196,7 @@ export const ExportJobsFlyout: FC = ({ isDisabled, currentTab }) => { setSelectedJobDependencies( jobDependencies.filter(({ jobId }) => selectedJobIds.includes(jobId)) ); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [selectedJobIds]); function switchTab(jobType: JobType) { diff --git a/x-pack/plugins/ml/public/application/components/import_export_jobs/import_jobs_flyout/import_jobs_flyout.tsx b/x-pack/plugins/ml/public/application/components/import_export_jobs/import_jobs_flyout/import_jobs_flyout.tsx index a47d6b478c0dd..0e786a63b222d 100644 --- a/x-pack/plugins/ml/public/application/components/import_export_jobs/import_jobs_flyout/import_jobs_flyout.tsx +++ b/x-pack/plugins/ml/public/application/components/import_export_jobs/import_jobs_flyout/import_jobs_flyout.tsx @@ -104,6 +104,7 @@ export const ImportJobsFlyout: FC = ({ isDisabled }) => { function onFlyoutChange() { reset(); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [showFlyout] ); @@ -170,6 +171,7 @@ export const ImportJobsFlyout: FC = ({ isDisabled }) => { } catch (error) { displayErrorToast(error); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const onImport = useCallback(async () => { @@ -191,6 +193,7 @@ export const ImportJobsFlyout: FC = ({ isDisabled }) => { setImporting(false); setShowFlyout(false); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobType, jobIdObjects, adJobs, dfaJobs]); const bulkCreateADJobs = useCallback(async (jobs: ImportedAdJob[]) => { @@ -219,6 +222,7 @@ export const ImportJobsFlyout: FC = ({ isDisabled }) => { displayImportErrorToast(errors, failedJobIds.size); mlUsageCollection.count('import_failed_anomaly_detector_jobs', failedJobIds.size); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const bulkCreateDfaJobs = useCallback(async (jobs: DataFrameAnalyticsConfig[]) => { @@ -240,6 +244,7 @@ export const ImportJobsFlyout: FC = ({ isDisabled }) => { displayImportErrorToast(errors, errors.length); mlUsageCollection.count('import_failed_data_frame_analytics_jobs', errors.length); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const displayImportSuccessToast = useCallback((count: number) => { @@ -248,6 +253,7 @@ export const ImportJobsFlyout: FC = ({ isDisabled }) => { values: { count }, }); displaySuccessToast(title); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const displayImportErrorToast = useCallback((errors: ErrorType[], failureCount: number) => { @@ -258,6 +264,7 @@ export const ImportJobsFlyout: FC = ({ isDisabled }) => { const errorList = errors.map(extractErrorProperties); displayErrorToast(errorList as unknown as ErrorType, title); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const deleteJob = useCallback( @@ -279,6 +286,7 @@ export const ImportJobsFlyout: FC = ({ isDisabled }) => { setIdsMash(ids); setValidatingJobs(true); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [jobIdObjects, adJobs, dfaJobs] ); @@ -306,6 +314,7 @@ export const ImportJobsFlyout: FC = ({ isDisabled }) => { setIdsMash(ids); setValidatingJobs(true); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [jobIdObjects] ); @@ -321,6 +330,7 @@ export const ImportJobsFlyout: FC = ({ isDisabled }) => { setIdsMash(ids); setValidatingJobs(true); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [jobIdObjects] ); diff --git a/x-pack/plugins/ml/public/application/components/import_export_jobs/import_jobs_flyout/validate.ts b/x-pack/plugins/ml/public/application/components/import_export_jobs/import_jobs_flyout/validate.ts index 4c8ebe4e017aa..611a3c464b440 100644 --- a/x-pack/plugins/ml/public/application/components/import_export_jobs/import_jobs_flyout/validate.ts +++ b/x-pack/plugins/ml/public/application/components/import_export_jobs/import_jobs_flyout/validate.ts @@ -111,6 +111,7 @@ export const useValidateIds = ( setJobIdObjects([...jobIdObjects]); setValidatingJobs(false); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [idsMash, jobIdObjects]); return [validateIds]; diff --git a/x-pack/plugins/ml/public/application/components/job_selector/job_selector.tsx b/x-pack/plugins/ml/public/application/components/job_selector/job_selector.tsx index 51dfe193f7ab0..a33530551a285 100644 --- a/x-pack/plugins/ml/public/application/components/job_selector/job_selector.tsx +++ b/x-pack/plugins/ml/public/application/components/job_selector/job_selector.tsx @@ -110,6 +110,7 @@ export function JobSelector({ dateFormatTz, singleSelection, timeseriesOnly }: J // Ensure JobSelectionBar gets updated when selection via globalState changes. useEffect(() => { setSelectedIds(mergeSelection(selectedJobIds, selectedGroups, singleSelection)); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [JSON.stringify([selectedJobIds, selectedGroups])]); function closeFlyout() { diff --git a/x-pack/plugins/ml/public/application/components/job_selector/job_selector_flyout.tsx b/x-pack/plugins/ml/public/application/components/job_selector/job_selector_flyout.tsx index 630bbe7e32ede..d686019125bbb 100644 --- a/x-pack/plugins/ml/public/application/components/job_selector/job_selector_flyout.tsx +++ b/x-pack/plugins/ml/public/application/components/job_selector/job_selector_flyout.tsx @@ -116,6 +116,7 @@ export const JobSelectorFlyoutContent: FC = ({ groups: groupSelection, time, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [onSelectionConfirmed, newSelection, jobGroupsMaps, applyTimeRangeConfig]); function removeId(id: string) { @@ -156,6 +157,7 @@ export const JobSelectorFlyoutContent: FC = ({ // Fetch jobs list on flyout open useEffect(() => { fetchJobs(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); async function fetchJobs() { diff --git a/x-pack/plugins/ml/public/application/components/job_selector/use_job_selection.ts b/x-pack/plugins/ml/public/application/components/job_selector/use_job_selection.ts index fc0acc43b0a64..2af031f117e81 100644 --- a/x-pack/plugins/ml/public/application/components/job_selector/use_job_selection.ts +++ b/x-pack/plugins/ml/public/application/components/job_selector/use_job_selection.ts @@ -44,6 +44,7 @@ export const useJobSelection = (jobs: MlJobWithTimeRange[]) => { const invalidIds = useMemo(() => { return getInvalidJobIds(jobs, tmpIds); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [tmpIds]); const validIds = useMemo(() => { @@ -70,6 +71,7 @@ export const useJobSelection = (jobs: MlJobWithTimeRange[]) => { }) ); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [invalidIds]); useEffect(() => { @@ -89,6 +91,7 @@ export const useJobSelection = (jobs: MlJobWithTimeRange[]) => { // flyout closed without selection }); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobs, validIds, setGlobalState, globalState?.ml]); return jobSelection; diff --git a/x-pack/plugins/ml/public/application/components/job_spaces_sync/job_spaces_sync_flyout.tsx b/x-pack/plugins/ml/public/application/components/job_spaces_sync/job_spaces_sync_flyout.tsx index a9f43f61ce7fd..ea1bac4b83972 100644 --- a/x-pack/plugins/ml/public/application/components/job_spaces_sync/job_spaces_sync_flyout.tsx +++ b/x-pack/plugins/ml/public/application/components/job_spaces_sync/job_spaces_sync_flyout.tsx @@ -61,6 +61,7 @@ export const JobSpacesSyncFlyout: FC = ({ onClose }) => { useEffect(() => { loadSyncList(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); async function sync() { diff --git a/x-pack/plugins/ml/public/application/components/jobs_awaiting_node_warning/new_job_awaiting_node_shared/new_job_awaiting_node_shared.tsx b/x-pack/plugins/ml/public/application/components/jobs_awaiting_node_warning/new_job_awaiting_node_shared/new_job_awaiting_node_shared.tsx index 866878d477e89..7c634cfed6682 100644 --- a/x-pack/plugins/ml/public/application/components/jobs_awaiting_node_warning/new_job_awaiting_node_shared/new_job_awaiting_node_shared.tsx +++ b/x-pack/plugins/ml/public/application/components/jobs_awaiting_node_warning/new_job_awaiting_node_shared/new_job_awaiting_node_shared.tsx @@ -52,6 +52,7 @@ const MLJobsAwaitingNodeWarning: FC = ({ jobIds }) => { // eslint-disable-next-line no-console console.error('Could not determine ML node information', error); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobIds]); const checkCloudInfo = useCallback(async () => { @@ -72,14 +73,17 @@ const MLJobsAwaitingNodeWarning: FC = ({ jobIds }) => { // eslint-disable-next-line no-console console.error('Could not determine cloud information', error); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [unassignedJobCount]); useEffect(() => { checkCloudInfo(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [unassignedJobCount]); useEffect(() => { checkNodes(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobIds]); if (unassignedJobCount === 0) { diff --git a/x-pack/plugins/ml/public/application/components/ml_embedded_map/ml_embedded_map.tsx b/x-pack/plugins/ml/public/application/components/ml_embedded_map/ml_embedded_map.tsx index 8d399e9234639..ae9dbac3c2d02 100644 --- a/x-pack/plugins/ml/public/application/components/ml_embedded_map/ml_embedded_map.tsx +++ b/x-pack/plugins/ml/public/application/components/ml_embedded_map/ml_embedded_map.tsx @@ -107,6 +107,7 @@ export function MlEmbeddedMapComponent({ setupEmbeddable(); // we want this effect to execute exactly once after the component mounts + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { diff --git a/x-pack/plugins/ml/public/application/components/ml_page/ml_page.tsx b/x-pack/plugins/ml/public/application/components/ml_page/ml_page.tsx index bd12a120420c2..4023cbb0562f8 100644 --- a/x-pack/plugins/ml/public/application/components/ml_page/ml_page.tsx +++ b/x-pack/plugins/ml/public/application/components/ml_page/ml_page.tsx @@ -54,6 +54,7 @@ export const MlPage: FC<{ pageDeps: PageDependencies }> = React.memo(({ pageDeps Object.values(routes) .map((routeFactory) => routeFactory(navigateToPath, basePath.get())) .filter((d) => !d.disabled), + // eslint-disable-next-line react-hooks/exhaustive-deps [] ); diff --git a/x-pack/plugins/ml/public/application/components/ml_page/side_nav.tsx b/x-pack/plugins/ml/public/application/components/ml_page/side_nav.tsx index 055359395270e..b87a128c0c788 100644 --- a/x-pack/plugins/ml/public/application/components/ml_page/side_nav.tsx +++ b/x-pack/plugins/ml/public/application/components/ml_page/side_nav.tsx @@ -59,6 +59,7 @@ export function useSideNavItems(activeRoute: MlRoute | undefined) { await navigateToPath(path, false); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [pageState] ); diff --git a/x-pack/plugins/ml/public/application/components/ml_saved_objects_spaces_list/ml_saved_objects_spaces_list.tsx b/x-pack/plugins/ml/public/application/components/ml_saved_objects_spaces_list/ml_saved_objects_spaces_list.tsx index 1d795398d7d71..ff78f79b7604d 100644 --- a/x-pack/plugins/ml/public/application/components/ml_saved_objects_spaces_list/ml_saved_objects_spaces_list.tsx +++ b/x-pack/plugins/ml/public/application/components/ml_saved_objects_spaces_list/ml_saved_objects_spaces_list.tsx @@ -86,7 +86,9 @@ export const MLSavedObjectsSpacesList: FC = ({ }); } + // eslint-disable-next-line react-hooks/exhaustive-deps const LazySpaceList = useCallback(spacesApi.ui.components.getSpaceList, [spacesApi]); + // eslint-disable-next-line react-hooks/exhaustive-deps const LazyShareToSpaceFlyout = useCallback(spacesApi.ui.components.getShareToSpaceFlyout, [ spacesApi, ]); diff --git a/x-pack/plugins/ml/public/application/components/model_snapshots/edit_model_snapshot_flyout/edit_model_snapshot_flyout.tsx b/x-pack/plugins/ml/public/application/components/model_snapshots/edit_model_snapshot_flyout/edit_model_snapshot_flyout.tsx index 1b9fb52587bda..b3952d700e93c 100644 --- a/x-pack/plugins/ml/public/application/components/model_snapshots/edit_model_snapshot_flyout/edit_model_snapshot_flyout.tsx +++ b/x-pack/plugins/ml/public/application/components/model_snapshots/edit_model_snapshot_flyout/edit_model_snapshot_flyout.tsx @@ -49,6 +49,7 @@ export const EditModelSnapshotFlyout: FC = ({ snapshot, job, closeFlyout useEffect(() => { setIsCurrentSnapshot(snapshot.snapshot_id === job.model_snapshot_id); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [snapshot]); const updateSnapshot = useCallback(async () => { @@ -65,6 +66,7 @@ export const EditModelSnapshotFlyout: FC = ({ snapshot, job, closeFlyout }), }); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [retain, description, snapshot]); const deleteSnapshot = useCallback(async () => { @@ -79,6 +81,7 @@ export const EditModelSnapshotFlyout: FC = ({ snapshot, job, closeFlyout }), }); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [snapshot]); function closeWithReload() { diff --git a/x-pack/plugins/ml/public/application/components/model_snapshots/model_snapshots_table.tsx b/x-pack/plugins/ml/public/application/components/model_snapshots/model_snapshots_table.tsx index 6e682979fa6b3..cfd586b3a3396 100644 --- a/x-pack/plugins/ml/public/application/components/model_snapshots/model_snapshots_table.tsx +++ b/x-pack/plugins/ml/public/application/components/model_snapshots/model_snapshots_table.tsx @@ -57,6 +57,7 @@ export const ModelSnapshotTable: FC = ({ job, refreshJobList }) => { return () => { isMounted.current = false; }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); async function loadModelSnapshots() { @@ -115,6 +116,7 @@ export const ModelSnapshotTable: FC = ({ job, refreshJobList }) => { if (reload) { loadModelSnapshots(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const closeRevertFlyout = useCallback(() => { @@ -125,6 +127,7 @@ export const ModelSnapshotTable: FC = ({ job, refreshJobList }) => { loadModelSnapshots(); // wait half a second before refreshing the jobs list setTimeout(refreshJobList, 500); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const columns: Array> = [ diff --git a/x-pack/plugins/ml/public/application/components/model_snapshots/revert_model_snapshot_flyout/create_calendar.tsx b/x-pack/plugins/ml/public/application/components/model_snapshots/revert_model_snapshot_flyout/create_calendar.tsx index 69e1bfe8a062a..5bb0eb7ad2db7 100644 --- a/x-pack/plugins/ml/public/application/components/model_snapshots/revert_model_snapshot_flyout/create_calendar.tsx +++ b/x-pack/plugins/ml/public/application/components/model_snapshots/revert_model_snapshot_flyout/create_calendar.tsx @@ -74,6 +74,7 @@ export const CreateCalendar: FC = ({ } } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [calendarEvents] ); @@ -90,6 +91,7 @@ export const CreateCalendar: FC = ({ setCalendarEvents([...calendarEvents]); } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [calendarEvents] ); @@ -106,6 +108,7 @@ export const CreateCalendar: FC = ({ setCalendarEvents([...calendarEvents]); } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [calendarEvents] ); @@ -117,6 +120,7 @@ export const CreateCalendar: FC = ({ setCalendarEvents([...calendarEvents]); } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [calendarEvents] ); @@ -128,6 +132,7 @@ export const CreateCalendar: FC = ({ setCalendarEvents(ce); } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [calendarEvents] ); diff --git a/x-pack/plugins/ml/public/application/components/model_snapshots/revert_model_snapshot_flyout/revert_model_snapshot_flyout.tsx b/x-pack/plugins/ml/public/application/components/model_snapshots/revert_model_snapshot_flyout/revert_model_snapshot_flyout.tsx index 20a5439aeb8ea..e6a76b4539a9d 100644 --- a/x-pack/plugins/ml/public/application/components/model_snapshots/revert_model_snapshot_flyout/revert_model_snapshot_flyout.tsx +++ b/x-pack/plugins/ml/public/application/components/model_snapshots/revert_model_snapshot_flyout/revert_model_snapshot_flyout.tsx @@ -78,6 +78,7 @@ export const RevertModelSnapshotFlyout: FC = ({ useEffect(() => { createChartData(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [currentSnapshot]); useEffect(() => { @@ -109,6 +110,7 @@ export const RevertModelSnapshotFlyout: FC = ({ setAnomalies(anomalyData[0]); } setChartReady(true); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [job]); function showRevertModal() { diff --git a/x-pack/plugins/ml/public/application/components/navigation_menu/date_picker_wrapper/date_picker_wrapper.tsx b/x-pack/plugins/ml/public/application/components/navigation_menu/date_picker_wrapper/date_picker_wrapper.tsx index 3cd74d2a53fe7..75cb787abadc4 100644 --- a/x-pack/plugins/ml/public/application/components/navigation_menu/date_picker_wrapper/date_picker_wrapper.tsx +++ b/x-pack/plugins/ml/public/application/components/navigation_menu/date_picker_wrapper/date_picker_wrapper.tsx @@ -92,6 +92,7 @@ export const DatePickerWrapper: FC = () => { }); } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [globalState?.time?.from, globalState?.time?.to, globalState?.time?.ts] ); @@ -104,9 +105,11 @@ export const DatePickerWrapper: FC = () => { }); } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [globalState?.refreshInterval] ); + // eslint-disable-next-line react-hooks/exhaustive-deps const setRefreshInterval = useCallback( debounce((refreshIntervalUpdate: RefreshInterval) => { setGlobalState('refreshInterval', refreshIntervalUpdate, true); @@ -133,6 +136,7 @@ export const DatePickerWrapper: FC = () => { const value = resultInterval.value; return { value, pause }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [JSON.stringify(globalState?.refreshInterval), timeFilterRefreshInterval]); useEffect( @@ -177,8 +181,11 @@ export const DatePickerWrapper: FC = () => { { toastLifeTimeMs: 30000 } ); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [ + // eslint-disable-next-line react-hooks/exhaustive-deps JSON.stringify(refreshInterval), + // eslint-disable-next-line react-hooks/exhaustive-deps JSON.stringify(globalState?.refreshInterval), setRefreshInterval, ] @@ -221,6 +228,7 @@ export const DatePickerWrapper: FC = () => { return function cleanup() { subscriptions.unsubscribe(); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const updateTimeFilter = useCallback( @@ -232,6 +240,7 @@ export const DatePickerWrapper: FC = () => { ...(start === 'now' || end === 'now' ? { ts: Date.now() } : {}), }); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [setGlobalState] ); diff --git a/x-pack/plugins/ml/public/application/components/page_header/page_header.tsx b/x-pack/plugins/ml/public/application/components/page_header/page_header.tsx index 0ae998db158fe..0423e718047c1 100644 --- a/x-pack/plugins/ml/public/application/components/page_header/page_header.tsx +++ b/x-pack/plugins/ml/public/application/components/page_header/page_header.tsx @@ -21,6 +21,7 @@ export const MlPageHeader: FC = ({ children }) => { return () => { setIsHeaderMounted(false); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return {children}; diff --git a/x-pack/plugins/ml/public/application/components/saved_objects_warning/saved_objects_warning.tsx b/x-pack/plugins/ml/public/application/components/saved_objects_warning/saved_objects_warning.tsx index 47d94c03e9ccb..a659f5c87bbdb 100644 --- a/x-pack/plugins/ml/public/application/components/saved_objects_warning/saved_objects_warning.tsx +++ b/x-pack/plugins/ml/public/application/components/saved_objects_warning/saved_objects_warning.tsx @@ -47,6 +47,7 @@ export const SavedObjectsWarning: FC = ({ } catch (error) { console.log('Saved object synchronization check could not be performed.'); // eslint-disable-line no-console } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [showSyncFlyout, setShowWarning]); useEffect( @@ -70,6 +71,7 @@ export const SavedObjectsWarning: FC = ({ if (typeof onCloseFlyout === 'function') { onCloseFlyout(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [checkStatus, onCloseFlyout, setShowSyncFlyout]); useEffect( diff --git a/x-pack/plugins/ml/public/application/components/scatterplot_matrix/scatterplot_matrix.tsx b/x-pack/plugins/ml/public/application/components/scatterplot_matrix/scatterplot_matrix.tsx index e11de5fea47d3..ee9cf024a6749 100644 --- a/x-pack/plugins/ml/public/application/components/scatterplot_matrix/scatterplot_matrix.tsx +++ b/x-pack/plugins/ml/public/application/components/scatterplot_matrix/scatterplot_matrix.tsx @@ -257,6 +257,7 @@ export const ScatterplotMatrix: FC = ({ options.didCancel = true; }; // stringify the fields array and search, otherwise the comparator will trigger on new but identical instances. + // eslint-disable-next-line react-hooks/exhaustive-deps }, [fetchSize, JSON.stringify({ fields, searchQuery }), index, randomizeQuery, resultsField]); const vegaSpec = useMemo(() => { @@ -275,6 +276,7 @@ export const ScatterplotMatrix: FC = ({ legendType, dynamicSize ); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [resultsField, splom, color, legendType, dynamicSize]); return ( diff --git a/x-pack/plugins/ml/public/application/components/scatterplot_matrix/use_scatterplot_field_options.ts b/x-pack/plugins/ml/public/application/components/scatterplot_matrix/use_scatterplot_field_options.ts index fe1a649cdeb06..7615c9cd2020c 100644 --- a/x-pack/plugins/ml/public/application/components/scatterplot_matrix/use_scatterplot_field_options.ts +++ b/x-pack/plugins/ml/public/application/components/scatterplot_matrix/use_scatterplot_field_options.ts @@ -47,5 +47,6 @@ export const useScatterplotFieldOptions = ( return Array.isArray(excludes) && excludes.length > 0 ? fields.filter((f) => !excludes.includes(f)) : fields; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [indexPattern, includes, excludes]); }; diff --git a/x-pack/plugins/ml/public/application/components/vega_chart/vega_chart_view.tsx b/x-pack/plugins/ml/public/application/components/vega_chart/vega_chart_view.tsx index 93276067f9663..011a3840563db 100644 --- a/x-pack/plugins/ml/public/application/components/vega_chart/vega_chart_view.tsx +++ b/x-pack/plugins/ml/public/application/components/vega_chart/vega_chart_view.tsx @@ -37,6 +37,7 @@ export const VegaChartView: FC = ({ vegaSpec }) => { .initialize(`#${htmlId}`); view.runAsync(); // evaluate and render the view + // eslint-disable-next-line react-hooks/exhaustive-deps }, [vegaSpec]); return
; diff --git a/x-pack/plugins/ml/public/application/contexts/kibana/use_cases_modal.ts b/x-pack/plugins/ml/public/application/contexts/kibana/use_cases_modal.ts index 206d6ddb806ae..0d7811822593e 100644 --- a/x-pack/plugins/ml/public/application/contexts/kibana/use_cases_modal.ts +++ b/x-pack/plugins/ml/public/application/contexts/kibana/use_cases_modal.ts @@ -48,6 +48,7 @@ export const useCasesModal = ( ], }); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [embeddableType] ); }; diff --git a/x-pack/plugins/ml/public/application/contexts/kibana/use_create_url.ts b/x-pack/plugins/ml/public/application/contexts/kibana/use_create_url.ts index 2f0165fffd293..cbd35193c8d94 100644 --- a/x-pack/plugins/ml/public/application/contexts/kibana/use_create_url.ts +++ b/x-pack/plugins/ml/public/application/contexts/kibana/use_create_url.ts @@ -38,6 +38,7 @@ export const useMlLink = (params: MlLocatorParams, getUrlParams?: LocatorGetUrlP return () => { isCancelled = true; }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [params, getUrlParams]); return href; @@ -71,6 +72,7 @@ export const useCreateAndNavigateToMlLink = ( const url = await mlLocator.getUrl({ page: _page, pageState }); await navigateToUrl(url); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [mlLocator, navigateToUrl] ); diff --git a/x-pack/plugins/ml/public/application/contexts/kibana/use_navigate_to_path.ts b/x-pack/plugins/ml/public/application/contexts/kibana/use_navigate_to_path.ts index 00050803b97c6..bd2d3303b8fd8 100644 --- a/x-pack/plugins/ml/public/application/contexts/kibana/use_navigate_to_path.ts +++ b/x-pack/plugins/ml/public/application/contexts/kibana/use_navigate_to_path.ts @@ -36,6 +36,7 @@ export const useNavigateToPath = () => { }); await navigateToUrl(url); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [location] ); }; diff --git a/x-pack/plugins/ml/public/application/contexts/kibana/use_timefilter.ts b/x-pack/plugins/ml/public/application/contexts/kibana/use_timefilter.ts index 4550f0fd2aa1f..cc4cb51169a32 100644 --- a/x-pack/plugins/ml/public/application/contexts/kibana/use_timefilter.ts +++ b/x-pack/plugins/ml/public/application/contexts/kibana/use_timefilter.ts @@ -34,6 +34,7 @@ export const useTimefilter = ({ } else if (autoRefreshSelector === false) { timefilter.disableAutoRefreshSelector(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [timeRangeSelector, autoRefreshSelector]); return timefilter; diff --git a/x-pack/plugins/ml/public/application/contexts/ml/use_storage.ts b/x-pack/plugins/ml/public/application/contexts/ml/use_storage.ts index e69df2c026795..d41dfedfa32ee 100644 --- a/x-pack/plugins/ml/public/application/contexts/ml/use_storage.ts +++ b/x-pack/plugins/ml/public/application/contexts/ml/use_storage.ts @@ -28,6 +28,7 @@ export function useStorage(key: MlStorageKey, initValue?: T): [T, (value: T) } catch (e) { throw new Error('Unable to update storage with provided value'); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return [val, setStorage]; diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/common/analytics.ts b/x-pack/plugins/ml/public/application/data_frame_analytics/common/analytics.ts index bb081e673badf..4638d3824ad61 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/common/analytics.ts +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/common/analytics.ts @@ -270,6 +270,7 @@ export const useRefreshAnalyticsList = ( return () => { subscriptions.map((sub) => sub.unsubscribe()); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [callback.onRefresh]); return { diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/common/use_results_view_config.ts b/x-pack/plugins/ml/public/application/data_frame_analytics/common/use_results_view_config.ts index df740df7fca3c..9f739bfb3d58c 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/common/use_results_view_config.ts +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/common/use_results_view_config.ts @@ -148,6 +148,7 @@ export const useResultsViewConfig = (jobId: string) => { setIsLoadingJobConfig(false); } })(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return { diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/advanced_step/advanced_step_form.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/advanced_step/advanced_step_form.tsx index 379861f133a20..a566aa685b7bc 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/advanced_step/advanced_step_form.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/advanced_step/advanced_step_form.tsx @@ -227,6 +227,7 @@ export const AdvancedStepForm: FC = ({ setFetchingAdvancedParamErrors(false); setAdvancedParamErrors(paramErrors); })(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ alpha, downsampleFactor, diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/analysis_fields_table.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/analysis_fields_table.tsx index f4a9eb0d5c0a8..85157569e64fb 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/analysis_fields_table.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/analysis_fields_table.tsx @@ -128,6 +128,7 @@ export const AnalysisFieldsTable: FC<{ }); } setMinimumFieldsRequiredMessage(undefined); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [tableItems]); useEffect(() => { diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/configuration_step_form.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/configuration_step_form.tsx index 758fd01a133c6..724aed7b08294 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/configuration_step_form.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/configuration_step_form.tsx @@ -335,6 +335,7 @@ export const ConfigurationStepForm: FC = ({ useEffect(() => { setFormState({ sourceIndex: currentDataView.title }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const indexPatternFieldsTableItems = useMemo(() => { @@ -346,12 +347,14 @@ export const ConfigurationStepForm: FC = ({ })); } return []; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [`${indexData?.indexPatternFields}`]); useEffect(() => { if (typeof savedSearchQueryStr === 'string') { setFormState({ jobConfigQuery: savedSearchQuery, jobConfigQueryString: savedSearchQueryStr }); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [JSON.stringify(savedSearchQuery), savedSearchQueryStr]); useEffect(() => { @@ -365,6 +368,7 @@ export const ConfigurationStepForm: FC = ({ loadDepVarOptions(form, runtimeOptions); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobType]); const handleRuntimeUpdate = useCallback(async () => { @@ -476,10 +480,12 @@ export const ConfigurationStepForm: FC = ({ } } } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [JSON.stringify(runtimeMappings)]); useEffect(() => { handleRuntimeUpdate(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [JSON.stringify(runtimeMappings)]); useEffect(() => { @@ -490,6 +496,7 @@ export const ConfigurationStepForm: FC = ({ return () => { debouncedGetExplainData.cancel(); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobType, dependentVariable, trainingPercent, JSON.stringify(includes), jobConfigQueryString]); const scatterplotMatrixProps = useMemo( @@ -504,6 +511,7 @@ export const ConfigurationStepForm: FC = ({ runtimeMappings, indexPattern: currentDataView, }), + // eslint-disable-next-line react-hooks/exhaustive-deps [ currentDataView.title, dependentVariable, @@ -523,6 +531,7 @@ export const ConfigurationStepForm: FC = ({ (jobType === ANALYSIS_CONFIG_TYPE.OUTLIER_DETECTION || (isJobTypeWithDepVar && !dependentVariableEmpty)) && scatterplotMatrixProps.fields.length > 1, + // eslint-disable-next-line react-hooks/exhaustive-deps [dependentVariableEmpty, jobType, scatterplotMatrixProps.fields.length] ); diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/supported_fields_message.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/supported_fields_message.tsx index 666f990aa4aa1..9e6d2ee0ad863 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/supported_fields_message.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/supported_fields_message.tsx @@ -92,6 +92,7 @@ export const SupportedFieldsMessage: FC = ({ jobType }) => { if (jobType !== undefined) { validateFields(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobType]); if (sourceIndexContainsSupportedFields === true) return null; diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/use_saved_search.ts b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/use_saved_search.ts index 0a75c6467f9d0..37526b6e66ff8 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/use_saved_search.ts +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/use_saved_search.ts @@ -85,6 +85,7 @@ export function useSavedSearch() { useEffect(() => { getQueryData(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return { diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/create_analytics_advanced_editor/create_analytics_advanced_editor.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/create_analytics_advanced_editor/create_analytics_advanced_editor.tsx index 8a74237a28144..56203e4784227 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/create_analytics_advanced_editor/create_analytics_advanced_editor.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/create_analytics_advanced_editor/create_analytics_advanced_editor.tsx @@ -52,6 +52,7 @@ export const CreateAnalyticsAdvancedEditor: FC = (prop ); } }, 400), + // eslint-disable-next-line react-hooks/exhaustive-deps [jobId] ); @@ -75,6 +76,7 @@ export const CreateAnalyticsAdvancedEditor: FC = (prop return () => { debouncedJobIdCheck.cancel(); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobId]); return ( diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/create_step/create_step.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/create_step/create_step.tsx index 19b1570d1cf63..c32530658e6f8 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/create_step/create_step.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/create_step/create_step.tsx @@ -58,6 +58,7 @@ export const CreateStep: FC = ({ actions, state, step }) => { if (canCreateDataView === false) { setFormState({ createIndexPattern: false }); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [capabilities]); if (step !== ANALYTICS_STEPS.CREATE) return null; diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/create_step_footer/create_step_footer.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/create_step_footer/create_step_footer.tsx index f8016bccb1832..4323e759298e9 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/create_step_footer/create_step_footer.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/create_step_footer/create_step_footer.tsx @@ -114,6 +114,7 @@ export const CreateStepFooter: FC = ({ jobId, jobType, showProgress }) => }, PROGRESS_REFRESH_INTERVAL_MS); return () => clearInterval(interval); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [initialized]); return ( diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/details_step/details_step_form.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/details_step/details_step_form.tsx index 6e702c8ab6d1d..a033137413ef4 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/details_step/details_step_form.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/details_step/details_step_form.tsx @@ -99,6 +99,7 @@ export const DetailsStepForm: FC = ({ ); } }, 400), + // eslint-disable-next-line react-hooks/exhaustive-deps [jobId] ); @@ -112,6 +113,7 @@ export const DetailsStepForm: FC = ({ return () => { debouncedJobIdCheck.cancel(); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobId]); useEffect(() => { @@ -128,6 +130,7 @@ export const DetailsStepForm: FC = ({ return () => { debouncedIndexCheck.cancel(); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [destinationIndex]); useEffect(() => { @@ -136,6 +139,7 @@ export const DetailsStepForm: FC = ({ } else if (destIndexSameAsId === false && hasSwitchedToEditor === false) { setFormState({ destinationIndex: '' }); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [destIndexSameAsId, jobId]); return ( diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/runtime_mappings/runtime_mappings.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/runtime_mappings/runtime_mappings.tsx index 962a06410ca50..0d30b6f572a64 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/runtime_mappings/runtime_mappings.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/runtime_mappings/runtime_mappings.tsx @@ -144,6 +144,7 @@ export const RuntimeMappings: FC = ({ actions, state }) => { runtimeMappings: combinedRuntimeMappings, }); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return ( diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/validation_step/validation_step_wrapper.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/validation_step/validation_step_wrapper.tsx index 25030801d8580..d5b2ba8251ad4 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/validation_step/validation_step_wrapper.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/validation_step/validation_step_wrapper.tsx @@ -91,6 +91,7 @@ export const ValidationStepWrapper: FC = ({ debouncedValidationChecks(); } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [ showValidationStep, dependentVariable, diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/hooks/use_index_data.ts b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/hooks/use_index_data.ts index a865417ff123d..e48358fdb6a3e 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/hooks/use_index_data.ts +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/hooks/use_index_data.ts @@ -125,6 +125,7 @@ export const useIndexData = ( } fetchDataGridSampleDocuments(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); // To be used for data grid column selection @@ -162,6 +163,7 @@ export const useIndexData = ( useEffect(() => { resetPagination(); // custom comparison + // eslint-disable-next-line react-hooks/exhaustive-deps }, [JSON.stringify(query)]); useEffect(() => { @@ -215,14 +217,17 @@ export const useIndexData = ( fetchIndexData(); } // custom comparison + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ indexPattern.title, indexPatternFields, + // eslint-disable-next-line react-hooks/exhaustive-deps JSON.stringify([query, pagination, sortingColumns, combinedRuntimeMappings]), ]); const dataLoader = useMemo( () => new DataLoader(indexPattern, toastNotifications), + // eslint-disable-next-line react-hooks/exhaustive-deps [indexPattern] ); @@ -250,9 +255,11 @@ export const useIndexData = ( fetchColumnChartsData(query); } // custom comparison + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ dataGrid.chartsVisible, indexPattern.title, + // eslint-disable-next-line react-hooks/exhaustive-deps JSON.stringify([query, dataGrid.visibleColumns, runtimeMappings]), ]); diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/page.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/page.tsx index 1c17e073ba0a7..bd5f7d3e6d9f2 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/page.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/page.tsx @@ -81,6 +81,7 @@ export const Page: FC = ({ jobId }) => { } })(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { @@ -88,6 +89,7 @@ export const Page: FC = ({ jobId }) => { activatedSteps.splice(currentStep, 1, true); setActivatedSteps(activatedSteps); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [currentStep]); const analyticsWizardSteps = [ diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/classification_exploration/evaluate_panel.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/classification_exploration/evaluate_panel.tsx index 8ba780a3e512a..e9a7cbf2c7c27 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/classification_exploration/evaluate_panel.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/classification_exploration/evaluate_panel.tsx @@ -193,6 +193,7 @@ export const EvaluatePanel: FC = ({ jobConfig, jobStatus, se }, }); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [rowIndex, columnId, setCellProps]); let cellContent = columnId === ACTUAL_CLASS_ID ? cellValue : accuracy; diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/classification_exploration/use_confusion_matrix.ts b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/classification_exploration/use_confusion_matrix.ts index c51f5bf3e9665..aaa357363253f 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/classification_exploration/use_confusion_matrix.ts +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/classification_exploration/use_confusion_matrix.ts @@ -135,6 +135,7 @@ export const useConfusionMatrix = ( } loadConfusionMatrixData(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [JSON.stringify([jobConfig, searchQuery])]); return { diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/classification_exploration/use_roc_curve.ts b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/classification_exploration/use_roc_curve.ts index f83f9f9f31e0f..56e034eec3cc8 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/classification_exploration/use_roc_curve.ts +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/classification_exploration/use_roc_curve.ts @@ -121,6 +121,7 @@ export const useRocCurve = ( } loadRocCurveData(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [JSON.stringify([jobConfig, searchQuery, columns])]); return { diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/expandable_section/expandable_section_analytics.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/expandable_section/expandable_section_analytics.tsx index 702536a3d9cc3..9dfa5a84f530c 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/expandable_section/expandable_section_analytics.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/expandable_section/expandable_section_analytics.tsx @@ -110,6 +110,7 @@ export const ExpandableSectionAnalytics: FC = ( useEffect(() => { fetchStats(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobId]); const analyticsSectionHeaderItems = getAnalyticsSectionHeaderItems(expandedRowItem); diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration_query_bar/exploration_query_bar.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration_query_bar/exploration_query_bar.tsx index c186903686015..79e7403cd3513 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration_query_bar/exploration_query_bar.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration_query_bar/exploration_query_bar.tsx @@ -84,6 +84,7 @@ export const ExplorationQueryBar: FC = ({ setIdToSelectedMap({ [filterKeyInEffect]: true }); } } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); /** @@ -120,6 +121,7 @@ export const ExplorationQueryBar: FC = ({ } catch (e) { setErrorMessage({ query: query.query as string, message: e.message }); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [query.query]); const searchSubmitHandler = (q: Query, filtering?: boolean) => { diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration_results_table/use_exploration_results.ts b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration_results_table/use_exploration_results.ts index 593ef5465d196..b52c06905792c 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration_results_table/use_exploration_results.ts +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration_results_table/use_exploration_results.ts @@ -84,11 +84,13 @@ export const useExplorationResults = ( options.didCancel = true; }; // custom comparison + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobConfig && jobConfig.id, dataGrid.pagination, searchQuery, dataGrid.sortingColumns]); const dataLoader = useMemo( () => indexPattern !== undefined ? new DataLoader(indexPattern, toastNotifications) : undefined, + // eslint-disable-next-line react-hooks/exhaustive-deps [indexPattern] ); @@ -116,9 +118,11 @@ export const useExplorationResults = ( fetchColumnChartsData(); } // custom comparison + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ dataGrid.chartsVisible, jobConfig?.dest.index, + // eslint-disable-next-line react-hooks/exhaustive-deps JSON.stringify([searchQuery, dataGrid.visibleColumns]), ]); const predictionFieldName = useMemo(() => { @@ -163,10 +167,12 @@ export const useExplorationResults = ( text: error, }); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [mlApiServices, jobConfig]); useEffect(() => { getAnalyticsBaseline(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobConfig]); const resultsField = jobConfig?.dest.results_field ?? DEFAULT_RESULTS_FIELD; diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/feature_importance/use_classification_path_data.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/feature_importance/use_classification_path_data.tsx index a956ffa934862..ad9f0b3d0bb71 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/feature_importance/use_classification_path_data.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/feature_importance/use_classification_path_data.tsx @@ -94,6 +94,7 @@ export const useDecisionPathData = ({ predictedProbability, }); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [baseline, featureImportance, predictedValue]); return { decisionPathData }; diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/job_config_error_callout/job_config_error_callout.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/job_config_error_callout/job_config_error_callout.tsx index 440bab4b27af5..9fc517d293e7f 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/job_config_error_callout/job_config_error_callout.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/job_config_error_callout/job_config_error_callout.tsx @@ -50,6 +50,7 @@ export const JobConfigErrorCallout: FC = ({ getUrlForApp('management', { path: 'kibana/indexPatterns', }), + // eslint-disable-next-line react-hooks/exhaustive-deps [] ); diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/outlier_exploration/use_outlier_data.ts b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/outlier_exploration/use_outlier_data.ts index 920023c23a2bd..f0814f8e9b45c 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/outlier_exploration/use_outlier_data.ts +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/outlier_exploration/use_outlier_data.ts @@ -62,6 +62,7 @@ export const useOutlierData = ( } return newColumns; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobConfig, indexPattern]); const dataGrid = useExplorationDataGrid( @@ -77,6 +78,7 @@ export const useOutlierData = ( if (jobConfig !== undefined) { dataGrid.setSortingColumns([{ id: getOutlierScoreFieldName(jobConfig), direction: 'desc' }]); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobConfig && jobConfig.id]); // The pattern using `didCancel` allows us to abort out of date remote request. @@ -89,6 +91,7 @@ export const useOutlierData = ( options.didCancel = true; }; // custom comparison + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobConfig && jobConfig.id, dataGrid.pagination, searchQuery, dataGrid.sortingColumns]); const dataLoader = useMemo( @@ -123,12 +126,14 @@ export const useOutlierData = ( fetchColumnChartsData(); } // custom comparison + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ dataGrid.chartsVisible, jobConfig?.dest.index, // Only trigger when search or the visible columns changes. // We're only interested in the visible columns but not their order, that's // why we sort for comparison (and copying it via spread to avoid sort in place). + // eslint-disable-next-line react-hooks/exhaustive-deps JSON.stringify([searchQuery, [...dataGrid.visibleColumns].sort()]), ]); diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/evaluate_panel.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/evaluate_panel.tsx index 1249b736960d8..4a10d0e3cd056 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/evaluate_panel.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/evaluate_panel.tsx @@ -218,6 +218,7 @@ export const EvaluatePanel: FC = ({ jobConfig, jobStatus, searchQuery }) setIsTrainingFilter(isTraining); loadData(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [JSON.stringify(searchQuery)]); return ( diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/page.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/page.tsx index 633afaa0c7b4a..b8ed840397675 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/page.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/page.tsx @@ -57,6 +57,7 @@ export const Page: FC<{ useEffect(function checkJobs() { checkJobsExist(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect( @@ -70,6 +71,7 @@ export const Page: FC<{ }); } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [analyticsId?.job_id, analyticsId?.model_id] ); diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_clone/use_clone_action.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_clone/use_clone_action.tsx index 7b1c1da9ac8a4..825a71934e786 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_clone/use_clone_action.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_clone/use_clone_action.tsx @@ -21,6 +21,7 @@ export const useCloneAction = (canCreateDataFrameAnalytics: boolean) => { const clickHandler = useCallback((item: DataFrameAnalyticsListRow) => { navigateToWizardWithClonedJob(item); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const action: DataFrameAnalyticsListAction = useMemo( @@ -33,6 +34,7 @@ export const useCloneAction = (canCreateDataFrameAnalytics: boolean) => { onClick: clickHandler, 'data-test-subj': 'mlAnalyticsJobCloneButton', }), + // eslint-disable-next-line react-hooks/exhaustive-deps [] ); diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_delete/use_delete_action.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_delete/use_delete_action.tsx index fe87521f028a3..4d1565c1769f3 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_delete/use_delete_action.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_delete/use_delete_action.tsx @@ -117,6 +117,7 @@ export const useDeleteAction = (canDeleteDataFrameAnalytics: boolean) => { checkIndexPatternExists(); // Check if an user has permission to delete the index & data view checkUserIndexPermission(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [isModalVisible]); const closeModal = () => setModalVisible(false); @@ -168,6 +169,7 @@ export const useDeleteAction = (canDeleteDataFrameAnalytics: boolean) => { onClick: (i: DataFrameAnalyticsListRow) => openDeleteJobCheckModal(i), 'data-test-subj': 'mlAnalyticsJobDeleteButton', }), + // eslint-disable-next-line react-hooks/exhaustive-deps [] ); diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_map/use_map_action.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_map/use_map_action.tsx index 6fdcc047bce9d..54161fa8c801a 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_map/use_map_action.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_map/use_map_action.tsx @@ -37,6 +37,7 @@ export const useMapAction = () => { await navigateToPath(path, false); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [globalState] ); diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_start/use_start_action.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_start/use_start_action.tsx index 8702a3470306b..56e648a77a956 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_start/use_start_action.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_start/use_start_action.tsx @@ -67,6 +67,7 @@ export const useStartAction = (canStartStopDataFrameAnalytics: boolean) => { onClick: openModal, 'data-test-subj': 'mlAnalyticsJobStartButton', }), + // eslint-disable-next-line react-hooks/exhaustive-deps [] ); diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_stop/use_stop_action.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_stop/use_stop_action.tsx index 04d4ddb387e4c..2a5c9e560a6d8 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_stop/use_stop_action.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_stop/use_stop_action.tsx @@ -46,6 +46,7 @@ export const useStopAction = (canStartStopDataFrameAnalytics: boolean) => { } } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [stopAnalytics] ); @@ -61,6 +62,7 @@ export const useStopAction = (canStartStopDataFrameAnalytics: boolean) => { onClick: clickHandler, 'data-test-subj': 'mlAnalyticsJobStopButton', }), + // eslint-disable-next-line react-hooks/exhaustive-deps [clickHandler] ); diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_view/use_view_action.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_view/use_view_action.tsx index 67af4f567e0f6..410f59ebaa098 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_view/use_view_action.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_view/use_view_action.tsx @@ -34,6 +34,7 @@ export const useViewAction = () => { const clickHandler = useCallback((item: DataFrameAnalyticsListRow) => { const analysisType = getAnalysisType(item.config.analysis) as DataFrameAnalysisConfigType; redirectToTab(item.id, analysisType); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const action: DataFrameAnalyticsListAction = useMemo( diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/analytics_list.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/analytics_list.tsx index 64be320648551..f9d4f08d649e4 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/analytics_list.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/analytics_list.tsx @@ -159,8 +159,10 @@ export const DataFrameAnalyticsList: FC = ({ useEffect(() => { filterList(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [searchQueryText]); + // eslint-disable-next-line react-hooks/exhaustive-deps const getAnalyticsCallback = useCallback(() => getAnalytics(true), []); // Subscribe to the refresh observable to trigger reloading the analytics list. @@ -173,6 +175,7 @@ export const DataFrameAnalyticsList: FC = ({ function updateOnTimerRefresh() { getAnalyticsCallback(); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [refreshObs] ); @@ -191,6 +194,7 @@ export const DataFrameAnalyticsList: FC = ({ const navigateToSourceSelection = useCallback(async () => { await navigateToPath(ML_PAGES.DATA_FRAME_ANALYTICS_SOURCE_SELECTION); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const handleSearchOnChange: EuiSearchBarProps['onChange'] = (search) => { diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/expanded_row.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/expanded_row.tsx index 2d072d1aecc1f..cbdb9dd6df971 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/expanded_row.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/expanded_row.tsx @@ -159,6 +159,7 @@ export const ExpandedRow: FC = ({ item }) => { if (jobIsCompleted && isRegressionJob) { loadData(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobIsCompleted]); const stateValues: any = { ...item.stats }; diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/expanded_row_messages_pane.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/expanded_row_messages_pane.tsx index 7b90648967f39..f74feda63ce6e 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/expanded_row_messages_pane.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/expanded_row_messages_pane.tsx @@ -50,10 +50,12 @@ export const ExpandedRowMessagesPane: FC = ({ analyticsId, dataTestSubj } }) ); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { getMessages(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useRefreshAnalyticsList({ onRefresh: getMessages }); diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/use_refresh_interval.ts b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/use_refresh_interval.ts index 0f236984f587c..b5f2a72295528 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/use_refresh_interval.ts +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/use_refresh_interval.ts @@ -85,5 +85,6 @@ export const useRefreshInterval = ( refreshIntervalSubscription.unsubscribe(); clearRefreshInterval(); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); // [] as comparator makes sure this only runs once }; diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/components/analytics_selector/analytics_id_selector.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/components/analytics_selector/analytics_id_selector.tsx index 544815ee7e4c5..15836fb276a46 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/components/analytics_selector/analytics_id_selector.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/components/analytics_selector/analytics_id_selector.tsx @@ -178,6 +178,7 @@ export function AnalyticsIdSelector({ if (jobsOnly === false) { fetchAnalyticsModels(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const applySelection = useCallback(() => { @@ -185,6 +186,7 @@ export function AnalyticsIdSelector({ setAnalyticsId(selected); } closeFlyout(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [selected?.model_id, selected?.job_id]); const pagination = { diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/job_map/components/controls.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/job_map/components/controls.tsx index 5df043792a7a5..dc8584ac9d1c1 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/job_map/components/controls.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/job_map/components/controls.tsx @@ -130,10 +130,12 @@ export const Controls: FC = React.memo( }) ); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [nodeLabel]); const onCloneJobClick = useCallback(async () => { navigateToWizardWithClonedJob({ config: details[nodeId], stats: details[nodeId]?.stats }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [nodeId]); const onActionsButtonClick = () => { @@ -177,6 +179,7 @@ export const Controls: FC = React.memo( setShowFlyout(false); } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [isModalVisible, deleteItem, didUntag] ); diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/job_map/components/cytoscape.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/job_map/components/cytoscape.tsx index 16d312f44b863..24f7b9035d62e 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/job_map/components/cytoscape.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/job_map/components/cytoscape.tsx @@ -108,6 +108,7 @@ export function Cytoscape({ cy.removeListener('data', undefined, dataHandler as cytoscape.EventHandler); } }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [cy, elements, height, width]); // Trigger a custom "data" event when data changes @@ -122,6 +123,7 @@ export function Cytoscape({ cy.trigger('data'); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [cy, elements]); // Reset the graph to original zoom and pan diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/job_map/job_map.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/job_map/job_map.tsx index a2c51463cdc6e..8a1f1cdc9501b 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/job_map/job_map.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/job_map/job_map.tsx @@ -110,18 +110,21 @@ export const JobMap: FC = ({ analyticsId, modelId, forceRefresh }) => { useEffect(() => { fetchAndSetElementsWrapper({ analyticsId, modelId }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [analyticsId, modelId]); useEffect(() => { if (forceRefresh === true) { fetchAndSetElementsWrapper({ analyticsId, modelId }); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [forceRefresh]); useEffect(() => { if (message !== undefined) { notifications.toasts.add(message); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [message]); useEffect( @@ -129,6 +132,7 @@ export const JobMap: FC = ({ analyticsId, modelId, forceRefresh }) => { if (!refresh) return; fetchAndSetElementsWrapper({ analyticsId, modelId }); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [refresh] ); diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/job_map/page.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/job_map/page.tsx index c2db3e5958151..084897cf61659 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/job_map/page.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/job_map/page.tsx @@ -69,6 +69,7 @@ export const Page: FC = () => { useEffect(function checkJobs() { checkJobsExist(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const getEmptyState = () => { diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/file_datavisualizer.tsx b/x-pack/plugins/ml/public/application/datavisualizer/file_based/file_datavisualizer.tsx index 9fcf0df33a0af..c849b921546ba 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/file_datavisualizer.tsx +++ b/x-pack/plugins/ml/public/application/datavisualizer/file_based/file_datavisualizer.tsx @@ -94,6 +94,7 @@ export const FileDataVisualizerPage: FC = () => { }, ], ], + // eslint-disable-next-line react-hooks/exhaustive-deps [mlLocator] ); @@ -103,6 +104,7 @@ export const FileDataVisualizerPage: FC = () => { const { getFileDataVisualizerComponent } = dataVisualizer; getFileDataVisualizerComponent().then(setFileDataVisualizer); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return ( diff --git a/x-pack/plugins/ml/public/application/datavisualizer/index_based/index_data_visualizer.tsx b/x-pack/plugins/ml/public/application/datavisualizer/index_based/index_data_visualizer.tsx index ae5c7c9948f18..90d0763aecda8 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/index_based/index_data_visualizer.tsx +++ b/x-pack/plugins/ml/public/application/datavisualizer/index_based/index_data_visualizer.tsx @@ -56,6 +56,7 @@ export const IndexDataVisualizerPage: FC = () => { const { getIndexDataVisualizerComponent } = dataVisualizer; getIndexDataVisualizerComponent().then(setIndexDataVisualizer); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const getAsyncMLCards = async ({ @@ -178,6 +179,7 @@ export const IndexDataVisualizerPage: FC = () => { const getAdditionalLinks: GetAdditionalLinks = useMemo( () => [getAsyncRecognizedModuleCards, getAsyncMLCards], + // eslint-disable-next-line react-hooks/exhaustive-deps [mlLocator] ); return IndexDataVisualizer ? ( diff --git a/x-pack/plugins/ml/public/application/explorer/actions/load_explorer_data.ts b/x-pack/plugins/ml/public/application/explorer/actions/load_explorer_data.ts index b65daf40f6761..71554deb514ed 100644 --- a/x-pack/plugins/ml/public/application/explorer/actions/load_explorer_data.ts +++ b/x-pack/plugins/ml/public/application/explorer/actions/load_explorer_data.ts @@ -216,14 +216,17 @@ export const useExplorerData = (): [Partial | undefined, (d: any) mlResultsService ); return loadExplorerDataProvider(mlResultsService, anomalyExplorerChartsService, timefilter); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const loadExplorerData$ = useMemo(() => new Subject(), []); + // eslint-disable-next-line react-hooks/exhaustive-deps const explorerData$ = useMemo(() => loadExplorerData$.pipe(switchMap(loadExplorerData)), []); const explorerData = useObservable(explorerData$); const update = useCallback((c) => { loadExplorerData$.next(c); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return [explorerData, update]; diff --git a/x-pack/plugins/ml/public/application/explorer/anomalies_map.tsx b/x-pack/plugins/ml/public/application/explorer/anomalies_map.tsx index 9f247fbce72c2..b9a1ef555dbc1 100644 --- a/x-pack/plugins/ml/public/application/explorer/anomalies_map.tsx +++ b/x-pack/plugins/ml/public/application/explorer/anomalies_map.tsx @@ -186,6 +186,7 @@ export const AnomaliesMap: FC = ({ anomalies, jobIds }) => { ); setEMSSuggestions(suggestions.filter(isDefined)); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [...jobIds]); useEffect( @@ -194,6 +195,7 @@ export const AnomaliesMap: FC = ({ anomalies, jobIds }) => { getEMSTermSuggestions(); } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [...jobIds] ); diff --git a/x-pack/plugins/ml/public/application/explorer/anomaly_context_menu.tsx b/x-pack/plugins/ml/public/application/explorer/anomaly_context_menu.tsx index 62dc5aa7b34bf..19e5d69b7b32c 100644 --- a/x-pack/plugins/ml/public/application/explorer/anomaly_context_menu.tsx +++ b/x-pack/plugins/ml/public/application/explorer/anomaly_context_menu.tsx @@ -100,6 +100,7 @@ export const AnomalyContextMenu: FC = ({ ); } return items; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [canEditDashboards, globalTimeRange, closePopoverOnAction, selectedJobs]); const jobIds = selectedJobs.map(({ id }) => id); diff --git a/x-pack/plugins/ml/public/application/explorer/anomaly_explorer_context.tsx b/x-pack/plugins/ml/public/application/explorer/anomaly_explorer_context.tsx index 0d529c1aac3e5..2fd8dc8f66014 100644 --- a/x-pack/plugins/ml/public/application/explorer/anomaly_explorer_context.tsx +++ b/x-pack/plugins/ml/public/application/explorer/anomaly_explorer_context.tsx @@ -61,10 +61,12 @@ export function useAnomalyExplorerContextValue( const [, , tableSeverityState] = useTableSeverity(); + // eslint-disable-next-line react-hooks/exhaustive-deps const mlResultsService = useMemo(() => mlResultsServiceProvider(mlApiServices), []); const anomalyTimelineService = useMemo(() => { return new AnomalyTimelineService(timefilter, uiSettings, mlResultsService); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return useMemo(() => { @@ -98,5 +100,6 @@ export function useAnomalyExplorerContextValue( anomalyTimelineStateService, chartsStateService, }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); } diff --git a/x-pack/plugins/ml/public/application/explorer/anomaly_timeline.tsx b/x-pack/plugins/ml/public/application/explorer/anomaly_timeline.tsx index 4e215c447ad36..6c062aa915491 100644 --- a/x-pack/plugins/ml/public/application/explorer/anomaly_timeline.tsx +++ b/x-pack/plugins/ml/public/application/explorer/anomaly_timeline.tsx @@ -255,6 +255,7 @@ export const AnomalyTimeline: FC = React.memo( } return panels; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [canEditDashboards, openCasesModal, viewBySwimlaneFieldName]); // If selecting a cell in the 'view by' swimlane, indicate the corresponding time in the Overall swimlane. @@ -284,6 +285,7 @@ export const AnomalyTimeline: FC = React.memo( const onResize = useCallback((value: number) => { anomalyTimelineStateService.setContainerWidth(value); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return ( diff --git a/x-pack/plugins/ml/public/application/explorer/dashboard_controls/add_swimlane_to_dashboard_controls.tsx b/x-pack/plugins/ml/public/application/explorer/dashboard_controls/add_swimlane_to_dashboard_controls.tsx index 2e5db456a3153..487e3484fc5f4 100644 --- a/x-pack/plugins/ml/public/application/explorer/dashboard_controls/add_swimlane_to_dashboard_controls.tsx +++ b/x-pack/plugins/ml/public/application/explorer/dashboard_controls/add_swimlane_to_dashboard_controls.tsx @@ -67,6 +67,7 @@ export const AddSwimlaneToDashboardControl: FC = ({ swimlaneType: selectedSwimlane, ...(selectedSwimlane === SWIMLANE_TYPE.VIEW_BY ? { viewBy } : {}), }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [selectedSwimlane]); const { addToDashboardAndEditCallback } = useAddToDashboardActions( diff --git a/x-pack/plugins/ml/public/application/explorer/dashboard_controls/use_add_to_dashboard_actions.tsx b/x-pack/plugins/ml/public/application/explorer/dashboard_controls/use_add_to_dashboard_actions.tsx index 1dbc5ac051b95..449d2bc5cae64 100644 --- a/x-pack/plugins/ml/public/application/explorer/dashboard_controls/use_add_to_dashboard_actions.tsx +++ b/x-pack/plugins/ml/public/application/explorer/dashboard_controls/use_add_to_dashboard_actions.tsx @@ -47,6 +47,7 @@ export function useAddToDashboardActions< }, }); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [getEmbeddableInput] ); diff --git a/x-pack/plugins/ml/public/application/explorer/dashboard_controls/use_dashboards_table.tsx b/x-pack/plugins/ml/public/application/explorer/dashboard_controls/use_dashboards_table.tsx index b79f4d93d10d6..ac023017d43f5 100644 --- a/x-pack/plugins/ml/public/application/explorer/dashboard_controls/use_dashboards_table.tsx +++ b/x-pack/plugins/ml/public/application/explorer/dashboard_controls/use_dashboards_table.tsx @@ -35,6 +35,7 @@ export const useDashboardTable = () => { return () => { fetchDashboards.cancel(); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const search: EuiTableProps['search'] = useMemo(() => { @@ -48,10 +49,12 @@ export const useDashboardTable = () => { 'data-test-subj': 'mlDashboardsSearchBox', }, }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const [dashboardItems, setDashboardItems] = useState([]); + // eslint-disable-next-line react-hooks/exhaustive-deps const fetchDashboards = useCallback( debounce(async (query?: string) => { try { diff --git a/x-pack/plugins/ml/public/application/explorer/explorer.tsx b/x-pack/plugins/ml/public/application/explorer/explorer.tsx index 562bc80ebfc00..a52d8bc22c9d5 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer.tsx +++ b/x-pack/plugins/ml/public/application/explorer/explorer.tsx @@ -205,6 +205,7 @@ export const Explorer: FC = ({ }, 0); } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [ collapseFn.current, panelsInitialized, @@ -225,6 +226,7 @@ export const Explorer: FC = ({ }, }); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [anomalyExplorerPanelState] ); @@ -253,6 +255,7 @@ export const Explorer: FC = ({ isCollapsed: !isCurrentlyCollapsed, }, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [anomalyExplorerPanelState]); const { displayWarningToast, displayDangerToast } = useToastNotificationService(); @@ -328,6 +331,7 @@ export const Explorer: FC = ({ ); } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [explorerState, language, filterSettings] ); @@ -343,6 +347,7 @@ export const Explorer: FC = ({ }) ); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const { diff --git a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container.js b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container.js index 73095e6b836d0..d000b5cd465ef 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container.js +++ b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container.js @@ -123,6 +123,7 @@ function ExplorerChartContainer({ }); return location; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [series?.jobId]); useEffect(() => { @@ -141,6 +142,7 @@ function ExplorerChartContainer({ return () => { isCancelled = true; }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [mlLocator, series]); useEffect( @@ -164,6 +166,7 @@ function ExplorerChartContainer({ isCancelled = true; }; }, + // eslint-disable-next-line react-hooks/exhaustive-deps [series] ); @@ -187,6 +190,7 @@ function ExplorerChartContainer({ recentlyAccessed ); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [explorerSeriesLink, recentlyAccessed]); const { detectorLabel, entityFields } = series; diff --git a/x-pack/plugins/ml/public/application/explorer/swimlane_annotation_container.tsx b/x-pack/plugins/ml/public/application/explorer/swimlane_annotation_container.tsx index 262ac0c37f405..6d98cc8cc2172 100644 --- a/x-pack/plugins/ml/public/application/explorer/swimlane_annotation_container.tsx +++ b/x-pack/plugins/ml/public/application/explorer/swimlane_annotation_container.tsx @@ -219,6 +219,7 @@ export const SwimlaneAnnotationContainer: FC = .on('mouseout', () => tooltipService.hide()); }); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [chartWidth, domain, annotationsData, tooltipService]); return
; diff --git a/x-pack/plugins/ml/public/application/explorer/swimlane_container.tsx b/x-pack/plugins/ml/public/application/explorer/swimlane_container.tsx index 9b121bc91098b..6fecb4d16ed6b 100644 --- a/x-pack/plugins/ml/public/application/explorer/swimlane_container.tsx +++ b/x-pack/plugins/ml/public/application/explorer/swimlane_container.tsx @@ -196,6 +196,7 @@ export const SwimlaneContainer: FC = ({ // Holds the container height for previously fetched data const containerHeightRef = useRef(); + // eslint-disable-next-line react-hooks/exhaustive-deps const resizeHandler = useCallback( throttle((e: { width: number; height: number }) => { const resultNewWidth = e.width - SWIM_LANE_LABEL_WIDTH; @@ -253,6 +254,7 @@ export const SwimlaneContainer: FC = ({ rowsCount * (CELL_HEIGHT + BORDER_WIDTH * 2) + (showLegend ? LEGEND_HEIGHT : 0) + (showTimeline ? X_AXIS_HEIGHT : 0); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [isLoading, rowsCount]); useEffect(() => { @@ -275,6 +277,7 @@ export const SwimlaneContainer: FC = ({ } return { x: selection.times.map((v) => v * 1000), y: selection.lanes }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [selection, swimlaneData, swimlaneType]); const showBrush = !!onCellsSelection; @@ -330,6 +333,7 @@ export const SwimlaneContainer: FC = ({ }; return theme; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ showSwimlane, swimlaneType, diff --git a/x-pack/plugins/ml/public/application/explorer/swimlane_pagination.tsx b/x-pack/plugins/ml/public/application/explorer/swimlane_pagination.tsx index b84747f138237..f2959cb641bb8 100644 --- a/x-pack/plugins/ml/public/application/explorer/swimlane_pagination.tsx +++ b/x-pack/plugins/ml/public/application/explorer/swimlane_pagination.tsx @@ -40,10 +40,12 @@ export const SwimLanePagination: FC = ({ const goToPage = useCallback((pageNumber: number) => { onPaginationChange({ fromPage: pageNumber + 1 }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const setPerPage = useCallback((perPageUpdate: number) => { onPaginationChange({ perPage: perPageUpdate }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const pageCount = Math.ceil(cardinality / perPage); diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/confirm_modals/close_jobs_confirm_modal.tsx b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/confirm_modals/close_jobs_confirm_modal.tsx index 5e7b7a18e3363..f0c78c3828aeb 100644 --- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/confirm_modals/close_jobs_confirm_modal.tsx +++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/confirm_modals/close_jobs_confirm_modal.tsx @@ -51,6 +51,7 @@ export const CloseJobsConfirmModal: FC = ({ unsetShowFunction(); } }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const showModal = useCallback((jobs: MlSummaryJob[]) => { diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/confirm_modals/stop_datafeeds_confirm_modal.tsx b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/confirm_modals/stop_datafeeds_confirm_modal.tsx index 1a6d9e1e433ff..2edd875279ad0 100644 --- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/confirm_modals/stop_datafeeds_confirm_modal.tsx +++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/confirm_modals/stop_datafeeds_confirm_modal.tsx @@ -52,6 +52,7 @@ export const StopDatafeedsConfirmModal: FC = ({ unsetShowFunction(); } }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const showModal = useCallback((jobs: MlSummaryJob[]) => { diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/datafeed_chart_flyout/datafeed_chart_flyout.tsx b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/datafeed_chart_flyout/datafeed_chart_flyout.tsx index 8c4b96207b3a5..53ca34886b9ca 100644 --- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/datafeed_chart_flyout/datafeed_chart_flyout.tsx +++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/datafeed_chart_flyout/datafeed_chart_flyout.tsx @@ -189,6 +189,7 @@ export const DatafeedChartFlyout: FC = ({ displayErrorToast(error, title); } setIsLoadingChartData(false); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [endDate, data.bucketSpan]); const getJobAndSnapshotData = useCallback(async () => { @@ -218,10 +219,12 @@ export const DatafeedChartFlyout: FC = ({ } catch (error) { displayErrorToast(error); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobId]); useEffect(function loadInitialData() { getJobAndSnapshotData(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect( @@ -231,6 +234,7 @@ export const DatafeedChartFlyout: FC = ({ getChartData(); } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [endDate, data.bucketSpan] ); @@ -644,6 +648,7 @@ export const JobListDatafeedChartFlyout: FC = ( return () => { unsetShowFunction(); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); if (isVisible === true && job !== undefined) { diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/datafeed_chart_flyout/edit_query_delay.tsx b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/datafeed_chart_flyout/edit_query_delay.tsx index 08513f20b0bce..2dce5e5dce529 100644 --- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/datafeed_chart_flyout/edit_query_delay.tsx +++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/datafeed_chart_flyout/edit_query_delay.tsx @@ -71,6 +71,7 @@ export const EditQueryDelay: FC<{ ); } setIsEditing(false); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [datafeedId, newQueryDelay]); const editButton = ( diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/delete_job_modal/delete_job_modal.tsx b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/delete_job_modal/delete_job_modal.tsx index 701ee35d9ca92..b7cadf0def05a 100644 --- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/delete_job_modal/delete_job_modal.tsx +++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/delete_job_modal/delete_job_modal.tsx @@ -52,6 +52,7 @@ export const DeleteJobModal: FC = ({ setShowFunction, unsetShowFunction, unsetShowFunction(); } }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const showModal = useCallback((jobs: MlSummaryJob[]) => { @@ -74,6 +75,7 @@ export const DeleteJobModal: FC = ({ setShowFunction, unsetShowFunction, closeModal(); refreshJobs(); }, DELETING_JOBS_REFRESH_INTERVAL_MS); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobIds, refreshJobs]); if (modalVisible === false || jobIds.length === 0) { diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/job_actions/results.js b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/job_actions/results.js index 9e60e9bcbe7fa..5bdf1ae389f46 100644 --- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/job_actions/results.js +++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/job_actions/results.js @@ -52,8 +52,10 @@ export function ResultLinks({ jobs }) { const { createLinkWithUserDefaults } = useCreateADLinks(); const timeSeriesExplorerLink = useMemo( () => createLinkWithUserDefaults('timeseriesexplorer', jobs), + // eslint-disable-next-line react-hooks/exhaustive-deps [jobs] ); + // eslint-disable-next-line react-hooks/exhaustive-deps const anomalyExplorerLink = useMemo(() => createLinkWithUserDefaults('explorer', jobs), [jobs]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/job_details/job_messages_pane.tsx b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/job_details/job_messages_pane.tsx index eba82184438a9..8b3ed99709cb5 100644 --- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/job_details/job_messages_pane.tsx +++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/job_details/job_messages_pane.tsx @@ -62,6 +62,7 @@ export const JobMessagesPane: FC = React.memo( } }; + // eslint-disable-next-line react-hooks/exhaustive-deps const refreshMessage = useCallback(fetchMessages, [jobId]); // Clear messages for last 24hrs and refresh jobs list @@ -82,10 +83,12 @@ export const JobMessagesPane: FC = React.memo( }) ); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobId, JSON.stringify(notificationIndices)]); useEffect(() => { fetchMessages(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const disabled = notificationIndices.length === 0; diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/job_filter_bar/job_filter_bar.tsx b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/job_filter_bar/job_filter_bar.tsx index 47a64dd90d502..dbc64d082f117 100644 --- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/job_filter_bar/job_filter_bar.tsx +++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/job_filter_bar/job_filter_bar.tsx @@ -56,6 +56,7 @@ export const JobFilterBar: FC = ({ queryText, setFilters }) = } catch (e) { return []; } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const queryInstance: Query = useMemo(() => { @@ -75,6 +76,7 @@ export const JobFilterBar: FC = ({ queryText, setFilters }) = if (queryText !== undefined) { setFilters(queryInstance); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [queryText]); const filters: SearchFilterConfig[] = useMemo( @@ -132,6 +134,7 @@ export const JobFilterBar: FC = ({ queryText, setFilters }) = options: () => loadGroups(), }, ], + // eslint-disable-next-line react-hooks/exhaustive-deps [] ); diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/reset_job_modal/reset_job_modal.tsx b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/reset_job_modal/reset_job_modal.tsx index 49a2b810c1000..97f6255d213fa 100644 --- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/reset_job_modal/reset_job_modal.tsx +++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/reset_job_modal/reset_job_modal.tsx @@ -51,6 +51,7 @@ export const ResetJobModal: FC = ({ setShowFunction, unsetShowFunction, r unsetShowFunction(); } }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const showModal = useCallback((tempJobs: MlSummaryJob[]) => { @@ -73,6 +74,7 @@ export const ResetJobModal: FC = ({ setShowFunction, unsetShowFunction, r setTimeout(() => { refreshJobs(); }, RESETTING_JOBS_REFRESH_INTERVAL_MS); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobIds, refreshJobs]); if (modalVisible === false || jobIds.length === 0) { diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/start_datafeed_modal/time_range_selector/time_range_selector.js b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/start_datafeed_modal/time_range_selector/time_range_selector.js index 05e8e60abc4fb..e3c6458fabda9 100644 --- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/start_datafeed_modal/time_range_selector/time_range_selector.js +++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/start_datafeed_modal/time_range_selector/time_range_selector.js @@ -252,6 +252,7 @@ const DatePickerWithInput = ({ date, onChange, minDate, setIsValid, tab }) => { setDateString(date.format(TIME_FORMAT)); setCurrentTab(tab); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [tab]); function onTextChange(e) { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/common/components/time_range_picker.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/common/components/time_range_picker.tsx index b86961aabaf98..31cc7b8a15a86 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/common/components/time_range_picker.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/common/components/time_range_picker.tsx @@ -46,6 +46,7 @@ export const TimeRangePicker: FC = ({ setTimeRange, timeRange }) => { end: endMoment.valueOf(), }); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [startMoment, endMoment]); // update our local start and end moment objects if @@ -54,6 +55,7 @@ export const TimeRangePicker: FC = ({ setTimeRange, timeRange }) => { useEffect(() => { setStartMoment(moment(timeRange.start)); setEndMoment(moment(timeRange.end)); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [JSON.stringify(timeRange)]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/util/model_memory_estimator.ts b/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/util/model_memory_estimator.ts index a0ca9e4502cc2..842e65cc77b6b 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/util/model_memory_estimator.ts +++ b/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/util/model_memory_estimator.ts @@ -92,6 +92,7 @@ export const useModelMemoryEstimator = ( // Initialize model memory estimator only once const modelMemoryEstimator = useMemo( () => modelMemoryEstimatorProvider(jobCreator, jobValidator), + // eslint-disable-next-line react-hooks/exhaustive-deps [] ); @@ -129,6 +130,7 @@ export const useModelMemoryEstimator = ( return () => { subscription.unsubscribe(); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); // Update model memory estimation payload on the job creator updates @@ -142,5 +144,6 @@ export const useModelMemoryEstimator = ( earliestMs: jobCreator.start, latestMs: jobCreator.end, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); }; diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/common/datafeed_preview_flyout/datafeed_preview.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/common/datafeed_preview_flyout/datafeed_preview.tsx index 48fa2f76ca1a9..5868b3df699d3 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/common/datafeed_preview_flyout/datafeed_preview.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/common/datafeed_preview_flyout/datafeed_preview.tsx @@ -51,6 +51,7 @@ export const DatafeedPreview: FC<{ } catch (error) { // fail silently } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [combinedJob]); const loadDataPreview = useCallback(async () => { @@ -89,6 +90,7 @@ export const DatafeedPreview: FC<{ ); setPreviewJsonString(errorText); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [combinedJob]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/common/edit_categorization_analyzer_flyout/edit_categorization_analyzer_flyout.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/common/edit_categorization_analyzer_flyout/edit_categorization_analyzer_flyout.tsx index 5c41147fb2299..0b62c73620208 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/common/edit_categorization_analyzer_flyout/edit_categorization_analyzer_flyout.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/common/edit_categorization_analyzer_flyout/edit_categorization_analyzer_flyout.tsx @@ -41,6 +41,7 @@ export const EditCategorizationAnalyzerFlyout: FC = () => { if (showJsonFlyout === true) { setCategorizationAnalyzerString(JSON.stringify(jobCreator.categorizationAnalyzer, null, 2)); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [showJsonFlyout]); function toggleJsonFlyout() { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/common/json_editor_flyout/json_editor_flyout.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/common/json_editor_flyout/json_editor_flyout.tsx index 1019c91bfd36e..5b16462300446 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/common/json_editor_flyout/json_editor_flyout.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/common/json_editor_flyout/json_editor_flyout.tsx @@ -56,6 +56,7 @@ export const JsonEditorFlyout: FC = ({ isDisabled, jobEditorMode, datafee useEffect(() => { setJobConfigString(jobCreator.formattedJobJson); setDatafeedConfigString(jobCreator.formattedDatafeedJson); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); useEffect(() => { @@ -72,6 +73,7 @@ export const JsonEditorFlyout: FC = ({ isDisabled, jobEditorMode, datafee } else { setTempCombinedJob(null); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [showJsonFlyout]); const editJsonMode = diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/common/model_memory_limit/model_memory_limit_input.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/common/model_memory_limit/model_memory_limit_input.tsx index b43e31d682ee8..b56f15ada0298 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/common/model_memory_limit/model_memory_limit_input.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/common/model_memory_limit/model_memory_limit_input.tsx @@ -25,14 +25,17 @@ export const ModelMemoryLimitInput: FC = () => { useEffect(() => { jobCreator.modelMemoryLimit = modelMemoryLimit === '' ? null : modelMemoryLimit; jobCreatorUpdate(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [modelMemoryLimit]); useEffect(() => { setModelMemoryLimit(jobCreator.modelMemoryLimit === null ? '' : jobCreator.modelMemoryLimit); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); useEffect(() => { setValidation(jobValidator.modelMemoryLimit); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobValidatorUpdated]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/data_view/change_data_view.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/data_view/change_data_view.tsx index 4ff22b93334b9..cc3b20966935b 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/data_view/change_data_view.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/data_view/change_data_view.tsx @@ -76,6 +76,7 @@ export const ChangeDataViewModal: FC = ({ onClose }) => { useEffect(function initialPageLoad() { setCurrentDataViewTitle(jobCreator.indexPatternTitle); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/frequency/frequency_input.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/frequency/frequency_input.tsx index 948b83e49bc34..2800f4be12f18 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/frequency/frequency_input.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/frequency/frequency_input.tsx @@ -23,6 +23,7 @@ export const FrequencyInput: FC = () => { useEffect(() => { jobCreator.frequency = frequency === '' ? null : frequency; jobCreatorUpdate(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [frequency]); useEffect(() => { @@ -30,10 +31,12 @@ export const FrequencyInput: FC = () => { const df = createDefaultFrequency(); setDefaultFrequency(df); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); useEffect(() => { setValidation(jobValidator.frequency); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobValidatorUpdated]); function createDefaultFrequency() { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/query/query_input.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/query/query_input.tsx index 26bb64957c925..f91a83e116586 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/query/query_input.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/query/query_input.tsx @@ -26,6 +26,7 @@ export const QueryInput: FC<{ setIsValidQuery(v: boolean): void }> = ({ setIsVal jobCreator.query = JSON.parse(queryString); jobCreatorUpdate(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [queryString]); useEffect(() => { @@ -39,11 +40,13 @@ export const QueryInput: FC<{ setIsValidQuery(v: boolean): void }> = ({ setIsVal setQueryString(actualQuery); } } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); useEffect(() => { const validJson = isValidJson(queryString); setIsValidQuery(validJson); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); function onChange(qs: string) { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/query_delay/query_delay_input.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/query_delay/query_delay_input.tsx index 055acc3731b6c..b88b6149b9170 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/query_delay/query_delay_input.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/query_delay/query_delay_input.tsx @@ -21,14 +21,17 @@ export const QueryDelayInput: FC = () => { useEffect(() => { jobCreator.queryDelay = queryDelay === '' ? null : queryDelay; jobCreatorUpdate(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [queryDelay]); useEffect(() => { setQueryDelay(jobCreator.queryDelay === null ? '' : jobCreator.queryDelay); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdate]); useEffect(() => { setValidation(jobValidator.queryDelay); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobValidatorUpdated]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/scroll_size/scroll_size_input.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/scroll_size/scroll_size_input.tsx index 0b8578b57167d..14095edeede95 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/scroll_size/scroll_size_input.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/scroll_size/scroll_size_input.tsx @@ -25,14 +25,17 @@ export const ScrollSizeInput: FC = () => { useEffect(() => { jobCreator.scrollSize = scrollSizeString === '' ? null : +scrollSizeString; jobCreatorUpdate(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [scrollSizeString]); useEffect(() => { setScrollSize(jobCreator.scrollSize === null ? '' : `${jobCreator.scrollSize}`); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdate]); useEffect(() => { setValidation(jobValidator.scrollSize); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobValidatorUpdated]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/time_field/time_field.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/time_field/time_field.tsx index a25e3b8097bd9..e1cfff0ee81b0 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/time_field/time_field.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/time_field/time_field.tsx @@ -22,10 +22,12 @@ export const TimeField: FC = () => { useEffect(() => { jobCreator.timeFieldName = timeFieldName; jobCreatorUpdate(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [timeFieldName]); useEffect(() => { setTimeFieldName(jobCreator.timeFieldName); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/datafeed.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/datafeed.tsx index 47e488ab201ec..29f757953ff96 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/datafeed.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/datafeed.tsx @@ -32,6 +32,7 @@ export const DatafeedStep: FC = ({ setCurrentStep, isCurrentStep }) = jobValidator.scrollSize.valid && jobValidator.validating === false; setNextActive(active); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobValidatorUpdated, isValidQuery]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/additional_section/components/calendars/calendars_selection.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/additional_section/components/calendars/calendars_selection.tsx index 04663b8dfbaea..65549e1276b1b 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/additional_section/components/calendars/calendars_selection.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/additional_section/components/calendars/calendars_selection.tsx @@ -56,11 +56,13 @@ export const CalendarsSelection: FC = () => { useEffect(() => { loadCalendars(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { jobCreator.calendars = selectedCalendars; jobCreatorUpdate(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [selectedCalendars.join()]); const comboBoxProps: EuiComboBoxProps = { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/annotations/annotations_switch.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/annotations/annotations_switch.tsx index 7bed1cc20cc74..12294a2e3fed4 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/annotations/annotations_switch.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/annotations/annotations_switch.tsx @@ -22,10 +22,12 @@ export const AnnotationsSwitch: FC = () => { useEffect(() => { jobCreator.modelChangeAnnotations = annotationsEnabled; jobCreatorUpdate(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [annotationsEnabled]); useEffect(() => { setShowCallout(jobCreator.modelPlot && !annotationsEnabled); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated, annotationsEnabled]); function toggleAnnotations() { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/dedicated_index/dedicated_index_switch.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/dedicated_index/dedicated_index_switch.tsx index 4040b900b0b86..b5785a326d916 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/dedicated_index/dedicated_index_switch.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/dedicated_index/dedicated_index_switch.tsx @@ -18,6 +18,7 @@ export const DedicatedIndexSwitch: FC = () => { useEffect(() => { jobCreator.useDedicatedIndex = useDedicatedIndex; jobCreatorUpdate(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [useDedicatedIndex]); function toggleModelPlot() { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/mml_callout.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/mml_callout.tsx index 75b28412250cd..72410baf3f23a 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/mml_callout.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/mml_callout.tsx @@ -17,6 +17,7 @@ export const MMLCallout: FC = () => { useEffect(() => { const value = jobValidator.latestValidationResult?.highCardinality?.value ?? null; setHighCardinality(value); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobValidatorUpdated]); return jobCreator.modelPlot && highCardinality !== null ? ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/model_plot/model_plot_switch.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/model_plot/model_plot_switch.tsx index 9548bc911c175..631922a388faa 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/model_plot/model_plot_switch.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/model_plot/model_plot_switch.tsx @@ -22,6 +22,7 @@ export const ModelPlotSwitch: FC = () => { useEffect(() => { jobCreator.modelPlot = modelPlotEnabled; jobCreatorUpdate(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [modelPlotEnabled]); useEffect(() => { @@ -32,6 +33,7 @@ export const ModelPlotSwitch: FC = () => { isCategorizationJobCreator(jobCreator) && jobCreator.aggregations.some((agg) => aggs.includes(agg.id)); setEnabled(isRareCategoryJob === false); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); function toggleModelPlot() { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/groups/groups_input.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/groups/groups_input.tsx index f325051d6f0a6..e6b6280898868 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/groups/groups_input.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/groups/groups_input.tsx @@ -29,11 +29,13 @@ export const GroupsInput: FC = () => { valid, message, }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobValidatorUpdated]); useEffect(() => { jobCreator.groups = selectedGroups; jobCreatorUpdate(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [selectedGroups.join()]); const options: EuiComboBoxOptionOption[] = existingJobsAndGroups.groupIds.map((g: string) => ({ diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/job_description/job_description_input.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/job_description/job_description_input.tsx index 1ec2fc4a5a175..e1a22e40a06f2 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/job_description/job_description_input.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/job_description/job_description_input.tsx @@ -17,6 +17,7 @@ export const JobDescriptionInput: FC = () => { useEffect(() => { jobCreator.description = jobDescription; jobCreatorUpdate(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobDescription]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/job_id/job_id_input.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/job_id/job_id_input.tsx index bc643fd4885c4..1b4405ea1e282 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/job_id/job_id_input.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/job_id/job_id_input.tsx @@ -29,11 +29,13 @@ export const JobIdInput: FC = () => { valid, message, }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobValidatorUpdated]); useEffect(() => { jobCreator.jobId = jobId; jobCreatorUpdate(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobId]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/job_details.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/job_details.tsx index 4f1a314dcf517..aefef92a096e4 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/job_details.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/job_details.tsx @@ -45,6 +45,7 @@ export const JobDetailsStep: FC = ({ jobValidator.latestValidationResult.groupIdsExist?.valid === true && jobValidator.validating === false; setNextActive(active); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobValidatorUpdated]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/advanced_detector_modal.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/advanced_detector_modal.tsx index 94bface8317a2..b7ec413b18e2a 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/advanced_detector_modal.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/advanced_detector_modal.tsx @@ -191,6 +191,7 @@ export const AdvancedDetectorModal: FC = ({ }; setDetector(dtr); setDescriptionPlaceholder(dtr); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ aggOption, fieldOption, @@ -211,6 +212,7 @@ export const AdvancedDetectorModal: FC = ({ const overField = getField(overFieldOption.label); setExcludeFrequentEnabled(byField !== null || overField !== null); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/advanced_view.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/advanced_view.tsx index 1e5e8fd990103..47c0b99fa2fdc 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/advanced_view.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/advanced_view.tsx @@ -26,6 +26,7 @@ export const AdvancedView: FC = ({ isActive, setCanProceed }) => { if (typeof setCanProceed === 'function') { setCanProceed(metricsValid && settingsValid); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [metricsValid, settingsValid]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/detector_list.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/detector_list.tsx index 637599f02b8f6..56b8a9f5e8245 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/detector_list.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/detector_list.tsx @@ -47,6 +47,7 @@ export const DetectorList: FC = ({ isActive, onEditJob, onDeleteJob }) => useEffect(() => { setDetectors(jobCreator.detectors); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); useEffect(() => { @@ -59,6 +60,7 @@ export const DetectorList: FC = ({ isActive, onEditJob, onDeleteJob }) => if (!jobValidator.categorizerMissingPerPartition.valid) { setValidation(jobValidator.categorizerMissingPerPartition); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobValidatorUpdated]); const Buttons: FC<{ index: number }> = ({ index }) => { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/metric_selection.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/metric_selection.tsx index 36fd27aaba27c..f6cfee8a2305c 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/metric_selection.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/metric_selection.tsx @@ -41,6 +41,7 @@ export const AdvancedDetectors: FC = ({ setIsValid }) => { useEffect(() => { setIsValid(jobCreator.detectors.length > 0); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); function closeModal() { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/agg_select/agg_select.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/agg_select/agg_select.tsx index 6ca18097a07a5..3b829a61d461f 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/agg_select/agg_select.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/agg_select/agg_select.tsx @@ -63,6 +63,7 @@ export const AggSelect: FC = ({ fields, changeHandler, selectedOptions, r useEffect(() => { setValidation(jobValidator.duplicateDetectors); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobValidatorUpdated]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/bucket_span/bucket_span.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/bucket_span/bucket_span.tsx index 8eb895f8110b7..3ff095668211e 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/bucket_span/bucket_span.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/bucket_span/bucket_span.tsx @@ -28,18 +28,22 @@ export const BucketSpan: FC = ({ setIsValid, hideEstimateButton = false } useEffect(() => { jobCreator.bucketSpan = bucketSpan; jobCreatorUpdate(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [bucketSpan]); useEffect(() => { setBucketSpan(jobCreator.bucketSpan); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); useEffect(() => { setValidation(jobValidator.bucketSpan); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobValidatorUpdated]); useEffect(() => { setIsValid(estimating === false); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [estimating]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/bucket_span_estimator/bucket_span_estimator.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/bucket_span_estimator/bucket_span_estimator.tsx index ef1c458f0e112..8018c881e3b2e 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/bucket_span_estimator/bucket_span_estimator.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/bucket_span_estimator/bucket_span_estimator.tsx @@ -26,11 +26,13 @@ export const BucketSpanEstimator: FC = ({ setEstimating }) => { useEffect(() => { setEstimating(status === ESTIMATE_STATUS.RUNNING); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [status]); useEffect(() => { setNoDetectors(jobCreator.detectors.length === 0); setIsUsingMlCategory(checkIsUsingMlCategory()); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdate]); function checkIsUsingMlCategory() { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/by_field/by_field.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/by_field/by_field.tsx index 44de94cd1aa41..41d5eb7b909bf 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/by_field/by_field.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/by_field/by_field.tsx @@ -23,12 +23,14 @@ export const ByFieldSelector: FC = ({ detectorIndex }) => { const { jobCreator: jc, jobCreatorUpdate, jobCreatorUpdated } = useContext(JobCreatorContext); const jobCreator = jc as PopulationJobCreator; + // eslint-disable-next-line react-hooks/exhaustive-deps const runtimeCategoryFields = useMemo(() => filterCategoryFields(jobCreator.runtimeFields), []); const allCategoryFields = useMemo( () => [...newJobCapsService.categoryFields, ...runtimeCategoryFields].sort((a, b) => a.name.localeCompare(b.name) ), + // eslint-disable-next-line react-hooks/exhaustive-deps [] ); @@ -46,11 +48,13 @@ export const ByFieldSelector: FC = ({ detectorIndex }) => { jobCreator.addInfluencer(byField.name); } jobCreatorUpdate(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [byField]); useEffect(() => { const bf = jobCreator.getByField(detectorIndex); setByField(bf); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); return ( @@ -85,6 +89,7 @@ function useFilteredCategoryFields( } else { setFields(allCategoryFields); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); return fields; diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_detector/categorization_detector.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_detector/categorization_detector.tsx index 06e1f772bb17f..1b325c4859087 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_detector/categorization_detector.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_detector/categorization_detector.tsx @@ -26,10 +26,12 @@ export const CategorizationDetector: FC = () => { jobCreator.setDetectorType(categorizationDetectorType); jobCreatorUpdate(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [categorizationDetectorType]); useEffect(() => { setCategorizationDetectorType(jobCreator.selectedDetectorType); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); function onCountSelection() { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/categorization_field.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/categorization_field.tsx index 6a441a909692b..127fa36e3e125 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/categorization_field.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/categorization_field.tsx @@ -31,10 +31,12 @@ export const CategorizationField: FC = () => { jobCreator.categorizationFieldName = categorizationFieldName; jobCreatorUpdate(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [categorizationFieldName]); useEffect(() => { setCategorizationFieldName(jobCreator.categorizationFieldName); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/categorization_field_select.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/categorization_field_select.tsx index 9d7a34628426c..a340b79b4567a 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/categorization_field_select.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/categorization_field_select.tsx @@ -22,6 +22,7 @@ export const CategorizationFieldSelect: FC = ({ fields, changeHandler, se const { jobCreator, jobCreatorUpdated } = useContext(JobCreatorContext); const options: EuiComboBoxOptionOption[] = useMemo( () => [...createFieldOptions(fields, jobCreator.additionalFields)], + // eslint-disable-next-line react-hooks/exhaustive-deps [fields, jobCreatorUpdated] ); diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_partition_field/categorization_per_partition.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_partition_field/categorization_per_partition.tsx index 082ace02b3a62..1ef030c1a4287 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_partition_field/categorization_per_partition.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_partition_field/categorization_per_partition.tsx @@ -27,6 +27,7 @@ export const CategorizationPerPartitionField: FC = () => { const [enablePerPartitionCategorization, setEnablePerPartitionCategorization] = useState(false); useEffect(() => { setEnablePerPartitionCategorization(jobCreator.perPartitionCategorization); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_partition_field/categorization_per_partition_dropdown.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_partition_field/categorization_per_partition_dropdown.tsx index 606ad8af09ba8..6f248acc3b902 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_partition_field/categorization_per_partition_dropdown.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_partition_field/categorization_per_partition_dropdown.tsx @@ -28,11 +28,13 @@ export const CategorizationPerPartitionFieldDropdown = ({ const filteredCategories = useMemo( () => categoryFields.filter((c) => c.id !== jobCreator.categorizationFieldName), + // eslint-disable-next-line react-hooks/exhaustive-deps [categoryFields, jobCreatorUpdated] ); useEffect(() => { jobCreator.categorizationPerPartitionField = categorizationPartitionFieldName; jobCreatorUpdate(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [categorizationPartitionFieldName]); useEffect(() => { @@ -48,6 +50,7 @@ export const CategorizationPerPartitionFieldDropdown = ({ } setCategorizationPartitionFieldName(jobCreator.categorizationPerPartitionField); setEnablePerPartitionCategorization(jobCreator.perPartitionCategorization); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); return ( = ({ const { jobCreator, jobCreatorUpdated } = useContext(JobCreatorContext); const options: EuiComboBoxOptionOption[] = useMemo( () => [...createFieldOptions(fields, jobCreator.additionalFields)], + // eslint-disable-next-line react-hooks/exhaustive-deps [fields, jobCreatorUpdated] ); diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_partition_field/categorization_per_partition_switch.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_partition_field/categorization_per_partition_switch.tsx index bd982085a8f28..5ad1c05b3e594 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_partition_field/categorization_per_partition_switch.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_partition_field/categorization_per_partition_switch.tsx @@ -25,6 +25,7 @@ export const CategorizationPerPartitionSwitch: FC = () => { useEffect(() => { setEnablePerPartitionCategorization(jobCreator.perPartitionCategorization); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); useEffect(() => { @@ -35,6 +36,7 @@ export const CategorizationPerPartitionSwitch: FC = () => { jobCreator.perPartitionCategorization = enablePerPartitionCategorization; jobCreatorUpdate(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [enablePerPartitionCategorization]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_partition_field/categorization_stop_on_warn_switch.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_partition_field/categorization_stop_on_warn_switch.tsx index d35f8af6399bd..004cd6e636a88 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_partition_field/categorization_stop_on_warn_switch.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_partition_field/categorization_stop_on_warn_switch.tsx @@ -21,10 +21,12 @@ export const CategorizationPerPartitionStopOnWarnSwitch: FC = () => { useEffect(() => { jobCreator.perPartitionStopOnWarn = stopOnWarn; jobCreatorUpdate(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [stopOnWarn]); useEffect(() => { setStopOnWarn(jobCreator.perPartitionStopOnWarn); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_view/categorization_view.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_view/categorization_view.tsx index 8033ec6f34783..881d758732534 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_view/categorization_view.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_view/categorization_view.tsx @@ -25,6 +25,7 @@ export const CategorizationView: FC = ({ isActive, setCanProceed }) => { if (typeof setCanProceed === 'function') { setCanProceed(categoryFieldValid && settingsValid); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [categoryFieldValid, settingsValid]); return isActive === false ? ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_view/category_stopped_partitions.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_view/category_stopped_partitions.tsx index b26667ad86b98..8030292bd9e59 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_view/category_stopped_partitions.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_view/category_stopped_partitions.tsx @@ -88,6 +88,7 @@ export const CategoryStoppedPartitions: FC = () => { .subscribe(); return () => resultsSubscription.unsubscribe(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_view/metric_selection.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_view/metric_selection.tsx index 34cba31aa17a5..1b89262c9e59f 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_view/metric_selection.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_view/metric_selection.tsx @@ -56,6 +56,7 @@ export const CategorizationDetectors: FC = ({ setIsValid }) => { jobCreatorUpdate(); } loadFieldExamples(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [categorizationFieldName]); useEffect(() => { @@ -77,6 +78,7 @@ export const CategorizationDetectors: FC = ({ setIsValid }) => { if (jobCreator.categorizationFieldName !== categorizationFieldName) { setCategorizationFieldName(jobCreator.categorizationFieldName); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); async function loadFieldExamples() { @@ -113,6 +115,7 @@ export const CategorizationDetectors: FC = ({ setIsValid }) => { useEffect(() => { jobCreatorUpdate(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [overallValidStatus]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_view/metric_selection_summary.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_view/metric_selection_summary.tsx index 157f44aa3a6cb..2cf10849fe054 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_view/metric_selection_summary.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_view/metric_selection_summary.tsx @@ -49,6 +49,7 @@ export const CategorizationDetectorsSummary: FC = () => { return () => { resultsSubscription.unsubscribe(); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); async function loadChart() { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_view/top_categories.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_view/top_categories.tsx index d4a121f094897..4491dfab1abdd 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_view/top_categories.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_view/top_categories.tsx @@ -53,6 +53,7 @@ export const TopCategories: FC = () => { return () => { resultsSubscription.unsubscribe(); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const columns = [ diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/influencers/influencers.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/influencers/influencers.tsx index 5050a4f3be8ea..c72d3afb23f32 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/influencers/influencers.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/influencers/influencers.tsx @@ -27,10 +27,12 @@ export const Influencers: FC = () => { jobCreator.removeAllInfluencers(); influencers.forEach((i) => jobCreator.addInfluencer(i)); jobCreatorUpdate(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [influencers.join()]); useEffect(() => { setInfluencers([...jobCreator.influencers]); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selection.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selection.tsx index 58252feca4b53..76afcc3263ee5 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selection.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selection.tsx @@ -36,6 +36,7 @@ export const MultiMetricDetectors: FC = ({ setIsValid }) => { const fields = useMemo( () => sortFields([...newJobCapsService.fields, ...jobCreator.runtimeFields]), + // eslint-disable-next-line react-hooks/exhaustive-deps [] ); const [selectedOptions, setSelectedOptions] = useState([]); @@ -87,6 +88,7 @@ export const MultiMetricDetectors: FC = ({ setIsValid }) => { jobCreatorUpdate(); loadCharts(); setIsValid(aggFieldPairList.length > 0); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [aggFieldPairList.length]); // watch for change in jobCreator @@ -103,6 +105,7 @@ export const MultiMetricDetectors: FC = ({ setIsValid }) => { } setSplitField(jobCreator.splitField); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); // watch for changes in split field. @@ -123,12 +126,14 @@ export const MultiMetricDetectors: FC = ({ setIsValid }) => { } else { setFieldValues([]); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [splitField]); // watch for changes in the split field values // reload the charts useEffect(() => { loadCharts(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [fieldValues]); async function loadCharts() { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selection_summary.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selection_summary.tsx index d6cbd09419f0b..02736f334a4ca 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selection_summary.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selection_summary.tsx @@ -59,12 +59,14 @@ export const MultiMetricDetectorsSummary: FC = () => { return () => { subscription.unsubscribe(); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { if (allDataReady()) { loadCharts(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [fieldValues]); async function loadCharts() { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/multi_metric_view.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/multi_metric_view.tsx index c9afbf181e678..a6f7dbb403102 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/multi_metric_view.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/multi_metric_view.tsx @@ -25,6 +25,7 @@ export const MultiMetricView: FC = ({ isActive, setCanProceed }) => { if (typeof setCanProceed === 'function') { setCanProceed(metricsValid && settingsValid); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [metricsValid, settingsValid]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_field/population_field.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_field/population_field.tsx index e3d11c0d894ba..40a968b6d13ef 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_field/population_field.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_field/population_field.tsx @@ -23,12 +23,14 @@ export const PopulationFieldSelector: FC = () => { const { jobCreator: jc, jobCreatorUpdate, jobCreatorUpdated } = useContext(JobCreatorContext); const jobCreator = jc as PopulationJobCreator | RareJobCreator; + // eslint-disable-next-line react-hooks/exhaustive-deps const runtimeCategoryFields = useMemo(() => filterCategoryFields(jobCreator.runtimeFields), []); const allCategoryFields = useMemo( () => [...newJobCapsService.categoryFields, ...runtimeCategoryFields].sort((a, b) => a.name.localeCompare(b.name) ), + // eslint-disable-next-line react-hooks/exhaustive-deps [] ); const categoryFields = useFilteredCategoryFields( @@ -49,10 +51,12 @@ export const PopulationFieldSelector: FC = () => { jobCreator.addInfluencer(populationField.name); } jobCreatorUpdate(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [populationField]); useEffect(() => { setPopulationField(jobCreator.populationField); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); return ( @@ -88,6 +92,7 @@ function useFilteredCategoryFields( setFields(allCategoryFields); } } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); return fields; diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selection.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selection.tsx index 1f669fea655b7..4faf6b8fdc3fc 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selection.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selection.tsx @@ -39,6 +39,7 @@ export const PopulationDetectors: FC = ({ setIsValid }) => { const fields = useMemo( () => sortFields([...newJobCapsService.fields, ...jobCreator.runtimeFields]), + // eslint-disable-next-line react-hooks/exhaustive-deps [] ); const [selectedOptions, setSelectedOptions] = useState([]); @@ -100,6 +101,7 @@ export const PopulationDetectors: FC = ({ setIsValid }) => { jobCreatorUpdate(); loadCharts(); setIsValid(aggFieldPairList.length > 0); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [aggFieldPairList.length]); // watch for changes in by field values @@ -108,6 +110,7 @@ export const PopulationDetectors: FC = ({ setIsValid }) => { // if the split field or by fields have changed useEffect(() => { loadCharts(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [JSON.stringify(fieldValuesPerDetector), populationField, pageReady]); // watch for change in jobCreator @@ -139,6 +142,7 @@ export const PopulationDetectors: FC = ({ setIsValid }) => { setAggFieldPairList(newList); updateByFields(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); // watch for changes in split field or by fields. @@ -146,6 +150,7 @@ export const PopulationDetectors: FC = ({ setIsValid }) => { // changes to fieldValues here will trigger the card effect via setFieldValuesPerDetector useEffect(() => { loadFieldExamples(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [populationField, byFieldsUpdated]); async function loadCharts() { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selection_summary.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selection_summary.tsx index 8ff8a85759911..e6e6706f6266e 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selection_summary.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selection_summary.tsx @@ -50,6 +50,7 @@ export const PopulationDetectorsSummary: FC = () => { return () => { subscription.unsubscribe(); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); // watch for changes in by field values @@ -60,6 +61,7 @@ export const PopulationDetectorsSummary: FC = () => { if (allDataReady()) { loadCharts(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [JSON.stringify(fieldValuesPerDetector), jobCreator.populationField]); // watch for changes in split field or by fields. @@ -67,6 +69,7 @@ export const PopulationDetectorsSummary: FC = () => { // changes to fieldValues here will trigger the card effect via setFieldValuesPerDetector useEffect(() => { loadFieldExamples(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreator.populationField]); async function loadCharts() { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/population_view.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/population_view.tsx index 90efe997b7bdf..24c2f1da95155 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/population_view.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/population_view.tsx @@ -25,6 +25,7 @@ export const PopulationView: FC = ({ isActive, setCanProceed }) => { if (typeof setCanProceed === 'function') { setCanProceed(metricsValid && settingsValid); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [metricsValid, settingsValid]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/rare_detector/rare_detector.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/rare_detector/rare_detector.tsx index 0587d90026ae4..9c4dd9d8c70ff 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/rare_detector/rare_detector.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/rare_detector/rare_detector.tsx @@ -37,6 +37,7 @@ export const RareDetector: FC = ({ onChange }) => { } else { setRareDetectorType(RARE_DETECTOR_TYPE.RARE); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { @@ -48,6 +49,7 @@ export const RareDetector: FC = ({ onChange }) => { jobCreator.frequentlyRare = rareDetectorType === RARE_DETECTOR_TYPE.FREQ_RARE_POPULATION; jobCreatorUpdate(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [rareDetectorType]); function onRareSelection() { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/rare_field/rare_field.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/rare_field/rare_field.tsx index 663136fc5aa21..bd3e0aeb93782 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/rare_field/rare_field.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/rare_field/rare_field.tsx @@ -19,12 +19,14 @@ export const RareFieldSelector: FC = () => { const { jobCreator: jc, jobCreatorUpdate, jobCreatorUpdated } = useContext(JobCreatorContext); const jobCreator = jc as RareJobCreator; + // eslint-disable-next-line react-hooks/exhaustive-deps const runtimeCategoryFields = useMemo(() => filterCategoryFields(jobCreator.runtimeFields), []); const allCategoryFields = useMemo( () => [...newJobCapsService.categoryFields, ...runtimeCategoryFields].sort((a, b) => a.name.localeCompare(b.name) ), + // eslint-disable-next-line react-hooks/exhaustive-deps [] ); const categoryFields = useFilteredCategoryFields( @@ -42,10 +44,12 @@ export const RareFieldSelector: FC = () => { jobCreator.addInfluencer(rareField.name); } jobCreatorUpdate(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [rareField]); useEffect(() => { setRareField(jobCreator.rareField); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); return ( @@ -76,6 +80,7 @@ function useFilteredCategoryFields( } else { setFields(allCategoryFields); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); return fields; diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/rare_view/detector_description.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/rare_view/detector_description.tsx index 38e52d3f1b5e8..33288020ce757 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/rare_view/detector_description.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/rare_view/detector_description.tsx @@ -25,6 +25,7 @@ export const DetectorDescription: FC = ({ detectorType }) => { useEffect(() => { const desc = createDetectorDescription(jobCreator, detectorType); setDescription(desc); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); if (description === null) { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/rare_view/metric_selection.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/rare_view/metric_selection.tsx index 1c1a8e83c478b..90acaf9ad4654 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/rare_view/metric_selection.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/rare_view/metric_selection.tsx @@ -40,6 +40,7 @@ export const RareDetectors: FC = ({ setIsValid, rareDetectorType, setRare } setIsValid(valid); setDetectorValid(valid); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/rare_view/metric_selection_summary.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/rare_view/metric_selection_summary.tsx index bb4b83f639beb..9cd1062231570 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/rare_view/metric_selection_summary.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/rare_view/metric_selection_summary.tsx @@ -45,6 +45,7 @@ export const RareDetectorsSummary: FC = () => { } else { return RARE_DETECTOR_TYPE.RARE; } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); function setResultsWrapper(results: Results) { @@ -67,6 +68,7 @@ export const RareDetectorsSummary: FC = () => { return () => { resultsSubscription.unsubscribe(); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); async function loadChart() { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/rare_view/rare_view.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/rare_view/rare_view.tsx index 4d0ed3b58973d..8e5f58894c407 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/rare_view/rare_view.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/rare_view/rare_view.tsx @@ -32,6 +32,7 @@ export const RareView: FC = ({ isActive, setCanProceed }) => { if (typeof setCanProceed === 'function') { setCanProceed(rareFieldValid && settingsValid); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [rareFieldValid, settingsValid]); return isActive === false ? ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/metric_selection.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/metric_selection.tsx index d41234bbedd81..73181555183d2 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/metric_selection.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/metric_selection.tsx @@ -35,6 +35,7 @@ export const SingleMetricDetectors: FC = ({ setIsValid }) => { const fields = useMemo( () => sortFields([...newJobCapsService.fields, ...jobCreator.runtimeFields]), + // eslint-disable-next-line react-hooks/exhaustive-deps [] ); const [selectedOptions, setSelectedOptions] = useState( @@ -66,6 +67,7 @@ export const SingleMetricDetectors: FC = ({ setIsValid }) => { loadChart(); setIsValid(aggFieldPair !== null); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [aggFieldPair]); useEffect(() => { @@ -79,6 +81,7 @@ export const SingleMetricDetectors: FC = ({ setIsValid }) => { setBucketSpanMs(jobCreator.bucketSpanMs); loadChart(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); async function loadChart() { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/metric_selection_summary.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/metric_selection_summary.tsx index 457be612c4fd4..310d03069a7f0 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/metric_selection_summary.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/metric_selection_summary.tsx @@ -48,6 +48,7 @@ export const SingleMetricDetectorsSummary: FC = () => { return () => { subscription.unsubscribe(); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); async function loadChart() { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/single_metric_view.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/single_metric_view.tsx index 2604f98a011b0..2620b4aa75a1a 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/single_metric_view.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/single_metric_view.tsx @@ -25,6 +25,7 @@ export const SingleMetricView: FC = ({ isActive, setCanProceed }) => { if (typeof setCanProceed === 'function') { setCanProceed(metricsValid && settingsValid); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [metricsValid, settingsValid]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/sparse_data/sparse_data_switch.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/sparse_data/sparse_data_switch.tsx index 74a2b98141eeb..49d22f18d3887 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/sparse_data/sparse_data_switch.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/sparse_data/sparse_data_switch.tsx @@ -20,6 +20,7 @@ export const SparseDataSwitch: FC = () => { useEffect(() => { jobCreator.sparseData = sparseData; jobCreatorUpdate(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [sparseData]); useEffect(() => { @@ -31,6 +32,7 @@ export const SparseDataSwitch: FC = () => { if (isCountOrSum === false && sparseData === true) { setSparseData(false); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); function toggleSparseData() { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_field/split_field.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_field/split_field.tsx index 146e9f9f92061..3eb1bd6ea840b 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_field/split_field.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_field/split_field.tsx @@ -23,12 +23,14 @@ export const SplitFieldSelector: FC = () => { const { jobCreator: jc, jobCreatorUpdate, jobCreatorUpdated } = useContext(JobCreatorContext); const jobCreator = jc as MultiMetricJobCreator | RareJobCreator; + // eslint-disable-next-line react-hooks/exhaustive-deps const runtimeCategoryFields = useMemo(() => filterCategoryFields(jobCreator.runtimeFields), []); const allCategoryFields = useMemo( () => [...newJobCapsService.categoryFields, ...runtimeCategoryFields].sort((a, b) => a.name.localeCompare(b.name) ), + // eslint-disable-next-line react-hooks/exhaustive-deps [] ); const categoryFields = useFilteredCategoryFields( @@ -45,10 +47,12 @@ export const SplitFieldSelector: FC = () => { jobCreator.addInfluencer(splitField.name); } jobCreatorUpdate(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [splitField]); useEffect(() => { setSplitField(jobCreator.splitField); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); return ( @@ -84,6 +88,7 @@ function useFilteredCategoryFields( setFields(allCategoryFields); } } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); return fields; diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/summary_count_field/summary_count_field.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/summary_count_field/summary_count_field.tsx index 3345b60ddd4d9..07d68778b32bc 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/summary_count_field/summary_count_field.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/summary_count_field/summary_count_field.tsx @@ -34,15 +34,18 @@ export const SummaryCountField: FC = () => { const [validation, setValidation] = useState(jobValidator.summaryCountField); useEffect(() => { setValidation(jobValidator.summaryCountField); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobValidatorUpdated]); useEffect(() => { jobCreator.summaryCountFieldName = summaryCountFieldName; jobCreatorUpdate(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [summaryCountFieldName]); useEffect(() => { setSummaryCountFieldName(jobCreator.summaryCountFieldName); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/pick_fields.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/pick_fields.tsx index 2461cfc9d9d04..faef0fef11c36 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/pick_fields.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/pick_fields.tsx @@ -33,6 +33,7 @@ export const PickFieldsStep: FC = ({ setCurrentStep, isCurrentStep }) useEffect(() => { setNextActive(selectionValid && jobValidator.isPickFieldsStepValid); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobValidatorUpdated, selectionValid]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/summary.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/summary.tsx index eca7f03a29ee8..25198f0685c8f 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/summary.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/summary.tsx @@ -64,6 +64,7 @@ export const SummaryStep: FC = ({ setCurrentStep, isCurrentStep }) => useEffect(() => { jobCreator.subscribeToProgress(setProgress); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { @@ -141,6 +142,7 @@ export const SummaryStep: FC = ({ setCurrentStep, isCurrentStep }) => useEffect(() => { setIsValid(jobValidator.validationSummary.basic); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobValidatorUpdated]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/time_range_step/time_range.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/time_range_step/time_range.tsx index 8bbc7fc5879d0..90bcf4e606859 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/time_range_step/time_range.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/time_range_step/time_range.tsx @@ -69,6 +69,7 @@ export const TimeRangeStep: FC = ({ setCurrentStep, isCurrentStep }) jobCreatorUpdate(); loadChart(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [JSON.stringify(timeRange)]); useEffect(() => { @@ -76,6 +77,7 @@ export const TimeRangeStep: FC = ({ setCurrentStep, isCurrentStep }) start: jobCreator.start, end: jobCreator.end, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); function fullTimeRangeCallback(range: GetTimeFieldRangeResponse) { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/validation_step/validation.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/validation_step/validation.tsx index ee0786379df51..2e8b017790724 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/validation_step/validation.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/validation_step/validation.tsx @@ -49,6 +49,7 @@ export const ValidationStep: FC = ({ setCurrentStep, isCurrentStep }) // force basic validation to run jobValidator.validate(() => {}, true); jobCreatorUpdate(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); // keep a record of the advanced validation in the jobValidator diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/new_job/page.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/new_job/page.tsx index fda28a063727f..71bfba6bfab69 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/new_job/page.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/new_job/page.tsx @@ -54,6 +54,7 @@ export const Page: FC = ({ existingJobsAndGroups, jobType }) => { mlContext.currentSavedSearch, mlContext.combinedQuery ), + // eslint-disable-next-line react-hooks/exhaustive-deps [jobType] ); @@ -185,6 +186,7 @@ export const Page: FC = ({ existingJobsAndGroups, jobType }) => { const chartLoader = useMemo( () => new ChartLoader(mlContext.currentDataView, jobCreator.query), + // eslint-disable-next-line react-hooks/exhaustive-deps [] ); @@ -192,6 +194,7 @@ export const Page: FC = ({ existingJobsAndGroups, jobType }) => { const resultsLoader = useMemo( () => new ResultsLoader(jobCreator, chartInterval, chartLoader), + // eslint-disable-next-line react-hooks/exhaustive-deps [] ); diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/new_job/wizard.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/new_job/wizard.tsx index 06d532e4bd793..77f1f85220185 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/new_job/wizard.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/new_job/wizard.tsx @@ -88,6 +88,7 @@ export const Wizard: FC = ({ return () => { return subscription.unsubscribe(); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { @@ -102,12 +103,14 @@ export const Wizard: FC = ({ setHighestStep(currentStep); setStringifiedConfigs(tempConfigs); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [jobCreatorUpdated]); useEffect(() => { jobCreator.subscribeToProgress(setProgress); setCurrentStep(firstWizardStep); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); // disable the step links if the job is running @@ -120,6 +123,7 @@ export const Wizard: FC = ({ if (currentStep >= highestStep) { setHighestStep(currentStep); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [currentStep]); useModelMemoryEstimator(jobCreator, jobValidator, jobCreatorUpdate, jobCreatorUpdated); diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/recognize/components/edit_job.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/recognize/components/edit_job.tsx index 8d5e7be5019b9..77694f707bb08 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/recognize/components/edit_job.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/recognize/components/edit_job.tsx @@ -63,6 +63,7 @@ export const EditJob: FC = ({ job, jobOverride, existingGroupIds, useEffect(() => { handleValidation(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [formState.jobGroups]); const onSave = () => { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/recognize/components/job_settings_form.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/recognize/components/job_settings_form.tsx index 3d7f56a710664..ff2be09d731fb 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/recognize/components/job_settings_form.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/recognize/components/job_settings_form.tsx @@ -89,10 +89,12 @@ export const JobSettingsForm: FC = ({ useEffect(() => { handleValidation(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [formState.jobPrefix]); useEffect(() => { onChange(formState); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [formState]); return ( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/recognize/page.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/recognize/page.tsx index b0afbd791aa4c..f2cc9b4cabb2c 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/recognize/page.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/recognize/page.tsx @@ -152,6 +152,7 @@ export const Page: FC = ({ moduleId, existingGroupIds }) => { useEffect(() => { loadModule(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); /** diff --git a/x-pack/plugins/ml/public/application/management/jobs_list/components/jobs_list_page/jobs_list_page.tsx b/x-pack/plugins/ml/public/application/management/jobs_list/components/jobs_list_page/jobs_list_page.tsx index df3067deb15b5..2d82464290314 100644 --- a/x-pack/plugins/ml/public/application/management/jobs_list/components/jobs_list_page/jobs_list_page.tsx +++ b/x-pack/plugins/ml/public/application/management/jobs_list/components/jobs_list_page/jobs_list_page.tsx @@ -86,8 +86,10 @@ export const JobsListPage: FC<{ useEffect(() => { check(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); + // eslint-disable-next-line react-hooks/exhaustive-deps const ContextWrapper = useCallback( spacesApi ? spacesApi.ui.components.getSpacesContextProvider : getEmptyFunctionComponent, [spacesApi] diff --git a/x-pack/plugins/ml/public/application/management/jobs_list/components/jobs_list_page/space_management/space_management.tsx b/x-pack/plugins/ml/public/application/management/jobs_list/components/jobs_list_page/space_management/space_management.tsx index f5ad133bc2420..6868bdfa4a4e7 100644 --- a/x-pack/plugins/ml/public/application/management/jobs_list/components/jobs_list_page/space_management/space_management.tsx +++ b/x-pack/plugins/ml/public/application/management/jobs_list/components/jobs_list_page/space_management/space_management.tsx @@ -88,6 +88,7 @@ export const SpaceManagement: FC = ({ spacesApi, setCurrentTab }) => { refresh(currentTabId); setPageIndex(0); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [currentTabId] ); @@ -161,6 +162,7 @@ export const SpaceManagement: FC = ({ spacesApi, setCurrentTab }) => { )} ); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [items, columns, isLoading, filters, currentTabId, refresh, onTableChange]); const tabs = useMemo( diff --git a/x-pack/plugins/ml/public/application/overview/components/analytics_panel/analytics_panel.tsx b/x-pack/plugins/ml/public/application/overview/components/analytics_panel/analytics_panel.tsx index 1d64794adecfa..e5c1bb867bbd9 100644 --- a/x-pack/plugins/ml/public/application/overview/components/analytics_panel/analytics_panel.tsx +++ b/x-pack/plugins/ml/public/application/overview/components/analytics_panel/analytics_panel.tsx @@ -56,6 +56,7 @@ export const AnalyticsPanel: FC = ({ setLazyJobCount }) => { useEffect(() => { getAnalytics(true); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [refresh]); const errorDisplay = ( diff --git a/x-pack/plugins/ml/public/application/overview/components/anomaly_detection_panel/anomaly_detection_panel.tsx b/x-pack/plugins/ml/public/application/overview/components/anomaly_detection_panel/anomaly_detection_panel.tsx index 8a4007d5b2835..a18065608fc83 100644 --- a/x-pack/plugins/ml/public/application/overview/components/anomaly_detection_panel/anomaly_detection_panel.tsx +++ b/x-pack/plugins/ml/public/application/overview/components/anomaly_detection_panel/anomaly_detection_panel.tsx @@ -134,6 +134,7 @@ export const AnomalyDetectionPanel: FC = ({ jobCreationDisabled, setLazyJ useEffect(() => { loadJobs(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [refresh?.timeRange]); const errorDisplay = ( diff --git a/x-pack/plugins/ml/public/application/routing/router.tsx b/x-pack/plugins/ml/public/application/routing/router.tsx index a761bce2ce38a..73829b0a76299 100644 --- a/x-pack/plugins/ml/public/application/routing/router.tsx +++ b/x-pack/plugins/ml/public/application/routing/router.tsx @@ -88,6 +88,7 @@ const LegacyHashUrlRedirect: FC = ({ children }) => { if (location.hash.startsWith('#/')) { history.push(location.hash.replace('#', '')); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [location.hash]); return <>{children}; diff --git a/x-pack/plugins/ml/public/application/routing/routes/explorer.tsx b/x-pack/plugins/ml/public/application/routing/routes/explorer.tsx index 83b487b8a3f5e..5f4c71a909720 100644 --- a/x-pack/plugins/ml/public/application/routing/routes/explorer.tsx +++ b/x-pack/plugins/ml/public/application/routing/routes/explorer.tsx @@ -131,6 +131,7 @@ const ExplorerUrlStateManager: FC = ({ jobsWithTim setInValidTimeRangeError(true); } } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [globalState?.time?.from, globalState?.time?.to, globalState?.time?.ts]); const getJobsWithStoppedPartitions = useCallback(async (selectedJobIds: string[]) => { @@ -163,6 +164,7 @@ const ExplorerUrlStateManager: FC = ({ jobsWithTim explorerService.clearJobs(); } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [JSON.stringify(jobIds)] ); @@ -176,6 +178,7 @@ const ExplorerUrlStateManager: FC = ({ jobsWithTim anomalyExplorerContext.anomalyTimelineStateService.destroy(); anomalyExplorerContext.chartsStateService.destroy(); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const [explorerData, loadExplorerData] = useExplorerData(); @@ -232,12 +235,14 @@ const ExplorerUrlStateManager: FC = ({ jobsWithTim loadExplorerDataConfig?.selectedJobs! ); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [loadExplorerDataConfig] ); useEffect(() => { if (!loadExplorerDataConfig || loadExplorerDataConfig?.selectedCells === undefined) return; loadExplorerData(loadExplorerDataConfig); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [JSON.stringify(loadExplorerDataConfig)]); const overallSwimlaneData = useObservable( diff --git a/x-pack/plugins/ml/public/application/routing/routes/jobs_list.tsx b/x-pack/plugins/ml/public/application/routing/routes/jobs_list.tsx index 6ac1faf22bccc..e6025147c3226 100644 --- a/x-pack/plugins/ml/public/application/routing/routes/jobs_list.tsx +++ b/x-pack/plugins/ml/public/application/routing/routes/jobs_list.tsx @@ -67,6 +67,7 @@ const PageWrapper: FC = ({ deps }) => { ? { pause: false, value: DEFAULT_REFRESH_INTERVAL_MS } : { pause: refreshPause, value: refreshValue }; timefilter.setRefreshInterval(refreshInterval); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const annotationUpdatesService = useMemo(() => new AnnotationUpdatesService(), []); diff --git a/x-pack/plugins/ml/public/application/routing/routes/timeseriesexplorer.tsx b/x-pack/plugins/ml/public/application/routing/routes/timeseriesexplorer.tsx index 3e535bae1361e..421e4d006ab94 100644 --- a/x-pack/plugins/ml/public/application/routing/routes/timeseriesexplorer.tsx +++ b/x-pack/plugins/ml/public/application/routing/routes/timeseriesexplorer.tsx @@ -138,6 +138,7 @@ export const TimeSeriesExplorerUrlStateManager: FC { const editCalendarMatch = useRouteMatch('/settings/calendars_list/edit_calendar/:calendarId'); const editFilterMatch = useRouteMatch('/settings/filter_lists/edit_filter_list/:filterId'); + // eslint-disable-next-line react-hooks/exhaustive-deps const routesMap = useMemo(() => keyBy(routesList, 'path'), []); const activeRoute = useMemo(() => { @@ -44,6 +45,7 @@ export const useActiveRoute = (routesList: MlRoute[]): MlRoute => { // Remove trailing slash from the pathname const pathnameKey = pathname.replace(/\/$/, ''); return routesMap[pathnameKey]; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [pathname]); const bannerId = useRef(); diff --git a/x-pack/plugins/ml/public/application/routing/use_refresh.ts b/x-pack/plugins/ml/public/application/routing/use_refresh.ts index ce4a03696034e..8148a013ebc6e 100644 --- a/x-pack/plugins/ml/public/application/routing/use_refresh.ts +++ b/x-pack/plugins/ml/public/application/routing/use_refresh.ts @@ -41,6 +41,7 @@ export const useRefresh = () => { ), annotationsRefresh$.pipe(map((d) => ({ lastRefresh: d }))) ); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return useObservable(refresh$); diff --git a/x-pack/plugins/ml/public/application/routing/use_resolver.ts b/x-pack/plugins/ml/public/application/routing/use_resolver.ts index 26ecb494ab00d..6e16b1d42e6f6 100644 --- a/x-pack/plugins/ml/public/application/routing/use_resolver.ts +++ b/x-pack/plugins/ml/public/application/routing/use_resolver.ts @@ -108,6 +108,7 @@ export const useResolver = ( await redirectToJobsManagementPage(); } })(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return { context, results }; diff --git a/x-pack/plugins/ml/public/application/services/toast_notification_service/toast_notification_service.ts b/x-pack/plugins/ml/public/application/services/toast_notification_service/toast_notification_service.ts index e967f3547b475..8bc7bc8c87e35 100644 --- a/x-pack/plugins/ml/public/application/services/toast_notification_service/toast_notification_service.ts +++ b/x-pack/plugins/ml/public/application/services/toast_notification_service/toast_notification_service.ts @@ -56,5 +56,6 @@ export function getToastNotificationService() { */ export function useToastNotificationService(): ToastNotificationService { const { toasts } = useNotifications(); + // eslint-disable-next-line react-hooks/exhaustive-deps return useMemo(() => toastNotificationServiceProvider(toasts), []); } diff --git a/x-pack/plugins/ml/public/application/settings/anomaly_detection_settings.tsx b/x-pack/plugins/ml/public/application/settings/anomaly_detection_settings.tsx index 98156d8860831..fbec86a8c77e9 100644 --- a/x-pack/plugins/ml/public/application/settings/anomaly_detection_settings.tsx +++ b/x-pack/plugins/ml/public/application/settings/anomaly_detection_settings.tsx @@ -44,6 +44,7 @@ export const AnomalyDetectionSettings: FC = () => { useEffect(() => { loadSummaryStats(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); async function loadSummaryStats() { diff --git a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/entity_control/entity_config.tsx b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/entity_control/entity_config.tsx index e0df0bac214e3..b7892f4797d48 100644 --- a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/entity_control/entity_config.tsx +++ b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/entity_control/entity_config.tsx @@ -58,6 +58,7 @@ export const EntityConfig: FC = ({ }), }, ]; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [isModelPlotEnabled, config]); const orderOptions: EuiRadioGroupOption[] = useMemo(() => { diff --git a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/plot_function_controls/plot_function_controls.tsx b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/plot_function_controls/plot_function_controls.tsx index 09c22b193d303..cd3706a4560f2 100644 --- a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/plot_function_controls/plot_function_controls.tsx +++ b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/plot_function_controls/plot_function_controls.tsx @@ -96,6 +96,7 @@ export const PlotByFunctionControls = ({ ); } } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ setFunctionDescription, selectedDetectorIndex, diff --git a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/series_controls/series_controls.tsx b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/series_controls/series_controls.tsx index 13d1527bda5b7..e5f3e097b5f54 100644 --- a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/series_controls/series_controls.tsx +++ b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/series_controls/series_controls.tsx @@ -193,6 +193,7 @@ export const SeriesControls: FC = ({ useEffect(() => { loadEntityValues(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [selectedJobId, selectedDetectorIndex, JSON.stringify(selectedEntities), resultFieldsConfig]); const entityFieldSearchChanged = debounce(async (entity, queryTerm) => { diff --git a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart_with_tooltip.tsx b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart_with_tooltip.tsx index 174ab8a682b5b..c9ca8250bedd9 100644 --- a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart_with_tooltip.tsx +++ b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart_with_tooltip.tsx @@ -65,6 +65,7 @@ export const TimeSeriesChartWithTooltips: FC = ), ...(error ? { text: extractErrorMessage(error) } : {}), }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { @@ -105,6 +106,7 @@ export const TimeSeriesChartWithTooltips: FC = return () => { unmounted = true; }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ selectedJob.job_id, detectorIndex, diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/delete_models_modal.tsx b/x-pack/plugins/ml/public/application/trained_models/models_management/delete_models_modal.tsx index 401f18ab3d3a0..b4f0bc0ec505e 100644 --- a/x-pack/plugins/ml/public/application/trained_models/models_management/delete_models_modal.tsx +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/delete_models_modal.tsx @@ -58,6 +58,7 @@ export const DeleteModelsModal: FC = ({ modelIds, onClos ); } onClose(true); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [modelIds, trainedModelsApiService]); return canDeleteModel ? ( diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/expanded_row.tsx b/x-pack/plugins/ml/public/application/trained_models/models_management/expanded_row.tsx index f2aec5b768461..879bed447c864 100644 --- a/x-pack/plugins/ml/public/application/trained_models/models_management/expanded_row.tsx +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/expanded_row.tsx @@ -62,6 +62,7 @@ export function useListItemsFormatter() { model_size_bytes: bytesFormatter, required_native_memory_bytes: bytesFormatter, }), + // eslint-disable-next-line react-hooks/exhaustive-deps [] ); @@ -167,6 +168,7 @@ export const ExpandedRow: FC = ({ item }) => { setModelItems(items); })(); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [stats.deployment_stats] ); diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/models_list.tsx b/x-pack/plugins/ml/public/application/trained_models/models_management/models_list.tsx index ce003996f2676..8073940aef438 100644 --- a/x-pack/plugins/ml/public/application/trained_models/models_management/models_list.tsx +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/models_list.tsx @@ -133,6 +133,7 @@ export const ModelsList: FC = ({ {} ); const [showTestFlyout, setShowTestFlyout] = useState(null); + // eslint-disable-next-line react-hooks/exhaustive-deps const getUserConfirmation = useMemo(() => getUserConfirmationProvider(overlays, theme), []); const getUserInputThreadingParams = useMemo( @@ -206,6 +207,7 @@ export const ModelsList: FC = ({ ); } setIsLoading(false); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [itemIdToExpandedRowMap]); useEffect( @@ -213,6 +215,7 @@ export const ModelsList: FC = ({ if (!refresh) return; fetchModelsData(); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [refresh] ); @@ -258,6 +261,7 @@ export const ModelsList: FC = ({ ); return false; } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); /** diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/inference_input_form.tsx b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/inference_input_form.tsx index 08de66d9a1ba1..a1d24330c1c44 100644 --- a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/inference_input_form.tsx +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/inference_input_form.tsx @@ -32,8 +32,11 @@ export const InferenceInputForm: FC = ({ inferrer }) => { const runningState = useObservable(inferrer.runningState$); const inputText = useObservable(inferrer.inputText$); + // eslint-disable-next-line react-hooks/exhaustive-deps const inputComponent = useMemo(() => inferrer.getInputComponent(), []); + // eslint-disable-next-line react-hooks/exhaustive-deps const outputComponent = useMemo(() => inferrer.getOutputComponent(), []); + // eslint-disable-next-line react-hooks/exhaustive-deps const infoComponent = useMemo(() => inferrer.getInfoComponent(), []); async function run() { diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/question_answering/question_answering_input.tsx b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/question_answering/question_answering_input.tsx index fffff1b382c76..8f485ac584953 100644 --- a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/question_answering/question_answering_input.tsx +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/question_answering/question_answering_input.tsx @@ -22,6 +22,7 @@ const QuestionInput: FC<{ useEffect(() => { inferrer.questionText$.next(questionText); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [questionText]); const runningState = useObservable(inferrer.runningState$); diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/fill_mask_output.tsx b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/fill_mask_output.tsx index 62a5a957f8a38..9c92d6714b613 100644 --- a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/fill_mask_output.tsx +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/fill_mask_output.tsx @@ -20,6 +20,7 @@ const FillMaskOutput: FC<{ inferrer: FillMaskInference; }> = ({ inferrer }) => { const result = useObservable(inferrer.inferenceResult$); + // eslint-disable-next-line react-hooks/exhaustive-deps const title = useMemo(() => inferrer.predictedValue(), []); if (!result) { diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/zero_shot_classification_input.tsx b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/zero_shot_classification_input.tsx index 8c497d6baa9d2..adccbd99e2d75 100644 --- a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/zero_shot_classification_input.tsx +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/zero_shot_classification_input.tsx @@ -22,6 +22,7 @@ const ClassNameInput: FC<{ useEffect(() => { inferrer.labelsText$.next(labelsText); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [labelsText]); const runningState = useObservable(inferrer.runningState$); diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_input.tsx b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_input.tsx index ff0cfd21fb82a..ca4af60e87856 100644 --- a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_input.tsx +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_input.tsx @@ -20,6 +20,7 @@ export const TextInput: FC<{ useEffect(() => { inferrer.inputText$.next(inputText); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [inputText]); const runningState = useObservable(inferrer.runningState$); diff --git a/x-pack/plugins/ml/public/application/trained_models/nodes_overview/memory_preview_chart.tsx b/x-pack/plugins/ml/public/application/trained_models/nodes_overview/memory_preview_chart.tsx index 3121878adf1ad..2decf3c1d2b1b 100644 --- a/x-pack/plugins/ml/public/application/trained_models/nodes_overview/memory_preview_chart.tsx +++ b/x-pack/plugins/ml/public/application/trained_models/nodes_overview/memory_preview_chart.tsx @@ -66,6 +66,7 @@ export const MemoryPreviewChart: FC = ({ memoryOverview colour: euiPaletteGray(5)[0], }, }), + // eslint-disable-next-line react-hooks/exhaustive-deps [] ); diff --git a/x-pack/plugins/ml/public/application/trained_models/nodes_overview/nodes_list.tsx b/x-pack/plugins/ml/public/application/trained_models/nodes_overview/nodes_list.tsx index 4455e9e2709a1..9e2480f265dd4 100644 --- a/x-pack/plugins/ml/public/application/trained_models/nodes_overview/nodes_list.tsx +++ b/x-pack/plugins/ml/public/application/trained_models/nodes_overview/nodes_list.tsx @@ -84,6 +84,7 @@ export const NodesList: FC = ({ compactView = false }) => { ); setIsLoading(false); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [itemIdToExpandedRowMap]); const toggleDetails = (item: NodeItem) => { @@ -184,6 +185,7 @@ export const NodesList: FC = ({ compactView = false }) => { function updateOnTimerRefresh() { fetchNodesData(); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [refresh] ); diff --git a/x-pack/plugins/ml/public/application/util/url_state.tsx b/x-pack/plugins/ml/public/application/util/url_state.tsx index a31b574681827..7e09942412644 100644 --- a/x-pack/plugins/ml/public/application/util/url_state.tsx +++ b/x-pack/plugins/ml/public/application/util/url_state.tsx @@ -151,6 +151,7 @@ export const UrlStateProvider: FC = ({ children }) => { console.error('Could not save url state', error); } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [searchString] ); @@ -170,6 +171,7 @@ export const useUrlState = ( if (typeof fullUrlState === 'object') { return fullUrlState[accessor]; } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [searchString]); const setUrlState = useCallback( @@ -277,6 +279,7 @@ export const usePageUrlState = ( prevPageState.current = result; return result; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [pageState]); const onStateUpdate = useCallback( diff --git a/x-pack/plugins/ml/public/embeddables/anomaly_charts/embeddable_anomaly_charts_container.tsx b/x-pack/plugins/ml/public/embeddables/anomaly_charts/embeddable_anomaly_charts_container.tsx index 85350629263e4..a0275176afa24 100644 --- a/x-pack/plugins/ml/public/embeddables/anomaly_charts/embeddable_anomaly_charts_container.tsx +++ b/x-pack/plugins/ml/public/embeddables/anomaly_charts/embeddable_anomaly_charts_container.tsx @@ -87,6 +87,7 @@ export const EmbeddableAnomalyChartsContainer: FC { @@ -97,6 +98,7 @@ export const EmbeddableAnomalyChartsContainer: FC { if (Math.abs(chartWidth - e.width) > 20) { diff --git a/x-pack/plugins/ml/public/embeddables/anomaly_charts/use_anomaly_charts_input_resolver.ts b/x-pack/plugins/ml/public/embeddables/anomaly_charts/use_anomaly_charts_input_resolver.ts index 3922932d53373..90d598f3b6853 100644 --- a/x-pack/plugins/ml/public/embeddables/anomaly_charts/use_anomaly_charts_input_resolver.ts +++ b/x-pack/plugins/ml/public/embeddables/anomaly_charts/use_anomaly_charts_input_resolver.ts @@ -136,20 +136,24 @@ export function useAnomalyChartsInputResolver( return () => { subscription.unsubscribe(); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { chartWidth$.next(chartWidth); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [chartWidth]); useEffect(() => { severity$.next(severity); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [severity]); useEffect(() => { if (error) { renderCallbacks.onError(error); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [error]); return { chartsData, isLoading, error }; diff --git a/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/embeddable_swim_lane_container.tsx b/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/embeddable_swim_lane_container.tsx index 03c5cf75672f3..c333bbab7ff9e 100644 --- a/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/embeddable_swim_lane_container.tsx +++ b/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/embeddable_swim_lane_container.tsx @@ -88,6 +88,7 @@ export const EmbeddableSwimLaneContainer: FC = ( fromPage, interval: swimlaneData?.interval, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [perPage, fromPage, swimlaneData]); const onCellsSelection = useCallback( @@ -102,6 +103,7 @@ export const EmbeddableSwimLaneContainer: FC = ( }); } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [swimlaneData, perPage, fromPage, setSelectedCells] ); diff --git a/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/swimlane_input_resolver.ts b/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/swimlane_input_resolver.ts index b87783592d6c3..d543ff4cc9bf1 100644 --- a/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/swimlane_input_resolver.ts +++ b/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/swimlane_input_resolver.ts @@ -78,6 +78,7 @@ export function useSwimlaneInputResolver( return getJobsObservable(embeddableInput$, anomalyDetectorService, setError).pipe( shareReplay(1) ); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const bucketInterval$ = useMemo(() => { @@ -95,6 +96,7 @@ export function useSwimlaneInputResolver( return prev.asSeconds() === curr.asSeconds(); }) ); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const fromPage$ = useMemo(() => new Subject(), []); @@ -107,6 +109,7 @@ export function useSwimlaneInputResolver( dateFormat: uiSettings.get('dateFormat'), 'dateFormat:scaled': uiSettings.get('dateFormat:scaled'), }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { @@ -222,31 +225,37 @@ export function useSwimlaneInputResolver( return () => { subscription.unsubscribe(); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { fromPage$.next(fromPage); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [fromPage]); useEffect(() => { if (perPage === undefined) return; perPage$.next(perPage); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [perPage]); useEffect(() => { chartWidth$.next(chartWidth); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [chartWidth]); useEffect(() => { if (error) { renderCallbacks.onError(error); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [error]); useEffect(() => { if (swimlaneData) { renderCallbacks.onRenderComplete(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [swimlaneData]); return [ diff --git a/x-pack/plugins/ml/public/embeddables/common/use_embeddable_execution_context.ts b/x-pack/plugins/ml/public/embeddables/common/use_embeddable_execution_context.ts index 68306c54c8590..6cd15c51594f4 100644 --- a/x-pack/plugins/ml/public/embeddables/common/use_embeddable_execution_context.ts +++ b/x-pack/plugins/ml/public/embeddables/common/use_embeddable_execution_context.ts @@ -42,6 +42,7 @@ export function useEmbeddableExecutionContext( ...parentExecutionContext, child, }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [parentExecutionContext, id]); useExecutionContext(executionContext, embeddableExecutionContext); diff --git a/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/flyout.tsx b/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/flyout.tsx index 7bbc54d1837a4..38e4bf1f327f1 100644 --- a/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/flyout.tsx +++ b/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/flyout.tsx @@ -49,6 +49,7 @@ export const LensLayerSelectionFlyout: FC = ({ onClose, embeddable }) => console.error('Layers could not be extracted from embeddable', error); onClose(); }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [data, lens, embeddable]); return ( diff --git a/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/layer/compatible_layer.tsx b/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/layer/compatible_layer.tsx index 342a37fe4b0c0..0e163f207edfb 100644 --- a/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/layer/compatible_layer.tsx +++ b/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/layer/compatible_layer.tsx @@ -84,6 +84,7 @@ export const CompatibleLayer: FC = ({ layer, layerIndex, embeddable }) => data.query.timefilter.timefilter, mlApiServices ), + // eslint-disable-next-line react-hooks/exhaustive-deps [data, uiSettings] ); From 129cb74f39f2d1df1bde7f10165fd53af24855fd Mon Sep 17 00:00:00 2001 From: James Gowdy Date: Mon, 5 Sep 2022 10:29:06 +0100 Subject: [PATCH 2/2] changes after main merge --- x-pack/plugins/ml/public/application/explorer/explorer.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/plugins/ml/public/application/explorer/explorer.tsx b/x-pack/plugins/ml/public/application/explorer/explorer.tsx index b980c796dba77..32a4f613c22d4 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer.tsx +++ b/x-pack/plugins/ml/public/application/explorer/explorer.tsx @@ -440,6 +440,7 @@ export const Explorer: FC = ({ ) .catch(console.error); // eslint-disable-line no-console } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [JSON.stringify(selectedJobIds)]); if (noJobsSelected && !loading) {