Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[bundle optimization] fix imports of react-use lib #82847

Merged
merged 8 commits into from
Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/plugins/home/public/application/components/home_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { HashRouter as Router, Switch, Route } from 'react-router-dom';
import { getTutorial } from '../load_tutorials';
import { replaceTemplateStrings } from './tutorial/replace_template_strings';
import { getServices } from '../kibana_services';
import { useMount } from 'react-use';
import useMount from 'react-use/lib/useMount';

const RedirectToDefaultApp = () => {
useMount(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import dateMath from '@elastic/datemath';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
import { isEqual, omit } from 'lodash';
import { useMount } from 'react-use';
import useMount from 'react-use/lib/useMount';
import { DocLinksStart } from 'src/core/public';

import { useKibana } from '../../../../kibana_react/public';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import { get } from 'lodash';
import React, { useState, useCallback } from 'react';
import { useMount } from 'react-use';
import useMount from 'react-use/lib/useMount';

import { EuiComboBox, EuiComboBoxOptionOption, EuiFormRow } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import React, { useState, useEffect } from 'react';
import { omit, isEqual } from 'lodash';
import { htmlIdGenerator, EuiButton, EuiSpacer } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { useMount } from 'react-use';
import useMount from 'react-use/lib/useMount';

import { Query, DataPublicPluginStart } from '../../../../data/public';
import { IUiSettingsClient } from '../../../../../core/public';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import React from 'react';
import { EuiFormRow, EuiSelect } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { useMount } from 'react-use';
import useMount from 'react-use/lib/useMount';

import {
isCompatibleAggregation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import React, { useCallback } from 'react';
import { EuiFormRow, EuiIconTip, EuiRange, EuiSpacer } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { useMount } from 'react-use';
import useMount from 'react-use/lib/useMount';

import { AggControlProps } from './agg_control_props';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import React from 'react';
import { EuiFormLabel, EuiSpacer } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { useMount } from 'react-use';
import useMount from 'react-use/lib/useMount';

import { AggParamType, IAggConfig, AggGroupNames } from '../../../../data/public';
import { useSubAggParamsHandlers } from './utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import React, { useCallback, useState } from 'react';
import { EuiFlexGroup, EuiFlexItem, EuiButton, EuiButtonEmpty, EuiToolTip } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
import { useDebounce } from 'react-use';
import useDebounce from 'react-use/lib/useDebounce';

import { Vis } from 'src/plugins/visualizations/public';
import { discardChanges, EditorAction } from './state';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ import './visualize_listing.scss';

import React, { useCallback, useRef, useMemo, useEffect } from 'react';
import { i18n } from '@kbn/i18n';
import { useUnmount, useMount } from 'react-use';
import useUnmount from 'react-use/lib/useUnmount';
import useMount from 'react-use/lib/useMount';

import { useLocation } from 'react-router-dom';

import { SavedObjectsFindOptionsReference } from '../../../../../core/public';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { i18n } from '@kbn/i18n';
import styled from 'styled-components';
import euiLightVars from '@elastic/eui/dist/eui_theme_light.json';
import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json';
import { useEvent } from 'react-use';
import useEvent from 'react-use/lib/useEvent';
import {
formatOptions,
selectableRenderOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { useRef } from 'react';
import { useWindowSize } from 'react-use';
import useWindowSize from 'react-use/lib/useWindowSize';

export function useRefDimensions() {
const ref = useRef<HTMLDivElement>(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import React, { useMemo } from 'react';
import { useDebounce } from 'react-use';
import useDebounce from 'react-use/lib/useDebounce';
import {
ScaleType,
AnnotationDomainTypes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import React, { useCallback, useMemo, useState } from 'react';
import { i18n } from '@kbn/i18n';
import { EuiLoadingSpinner, EuiSpacer, EuiButton, EuiCallOut } from '@elastic/eui';
import { useMount } from 'react-use';
import useMount from 'react-use/lib/useMount';
import { GroupByExpression } from '../../../common/group_by_expression/group_by_expression';
import {
ForLastExpression,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import React, { useMemo } from 'react';
import { noop } from 'lodash';
import { useMount } from 'react-use';
import useMount from 'react-use/lib/useMount';
import { euiStyled } from '../../../../observability/public';

import { LogEntriesCursor } from '../../../common/http_api';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { EuiSpacer, EuiSteps, EuiText, EuiTitle } from '@elastic/eui';
import React, { useCallback, useMemo } from 'react';
import { useMount } from 'react-use';
import useMount from 'react-use/lib/useMount';
import { useLogEntryCategoriesSetup } from '../../../../containers/logs/log_analysis/modules/log_entry_categories';
import { createInitialConfigurationStep } from '../initial_configuration_step';
import { createProcessStep } from '../process_step';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { isEqual } from 'lodash';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { usePrevious } from 'react-use';
import usePrevious from 'react-use/lib/usePrevious';
import {
combineDatasetFilters,
DatasetFilter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { useMemo, useState } from 'react';
import { useDeepCompareEffect } from 'react-use';
import useDeepCompareEffect from 'react-use/lib/useDeepCompareEffect';
import {
CategoryQualityWarningReason,
QualityWarning,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import createContainer from 'constate';
import { useState, useContext } from 'react';
import { useThrottle } from 'react-use';
import useThrottle from 'react-use/lib/useThrottle';
import { useLogEntryHighlights } from './log_entry_highlights';
import { useLogSummaryHighlights } from './log_summary_highlights';
import { useNextAndPrevious } from './next_and_previous';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { useState, useMemo, useEffect, useCallback } from 'react';
import createContainer from 'constate';
import { useSetState } from 'react-use';
import useSetState from 'react-use/lib/useSetState';
import { TimeKey } from '../../../../common/time';
import { datemathToEpochMillis, isValidDatemath } from '../../../utils/datemath';
import { useKibanaTimefilterTime } from '../../../hooks/use_kibana_timefilter_time';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import createContainer from 'constate';
import { useCallback, useMemo, useState } from 'react';
import { useMountedState } from 'react-use';
import useMountedState from 'react-use/lib/useMountedState';
import type { HttpHandler } from 'src/core/public';
import {
LogSourceConfiguration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { useContext } from 'react';
import { useThrottle } from 'react-use';
import useThrottle from 'react-use/lib/useThrottle';

import { RendererFunction } from '../../../utils/typed_react';
import { LogSummaryBuckets, useLogSummary } from './log_summary';
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/infra/public/hooks/use_kibana_space.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { useAsync } from 'react-use';
import useAsync from 'react-use/lib/useAsync';
import { useKibanaContextForPlugin } from '../hooks/use_kibana';
import type { Space } from '../../../spaces/public';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
*/

import { useCallback } from 'react';
import { useUpdateEffect, useMount } from 'react-use';

import useUpdateEffect from 'react-use/lib/useUpdateEffect';
import useMount from 'react-use/lib/useMount';

import { useKibanaContextForPlugin } from './use_kibana';
import { TimeRange, TimefilterContract } from '../../../../../src/plugins/data/public';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n';
import flowRight from 'lodash/flowRight';
import React from 'react';
import { Redirect, RouteComponentProps } from 'react-router-dom';
import { useMount } from 'react-use';
import useMount from 'react-use/lib/useMount';
import { HttpStart } from 'src/core/public';
import { useKibana } from '../../../../../../src/plugins/kibana_react/public';
import { findInventoryFields } from '../../../common/inventory_models';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { EuiBasicTable, EuiBasicTableColumn } from '@elastic/eui';
import numeral from '@elastic/numeral';
import { i18n } from '@kbn/i18n';
import React, { useMemo } from 'react';
import { useSet } from 'react-use';
import useSet from 'react-use/lib/useSet';

import { euiStyled } from '../../../../../../../observability/public';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiStat, EuiTitle } from '@elastic/eui';
import numeral from '@elastic/numeral';
import { i18n } from '@kbn/i18n';
import React from 'react';
import { useMount } from 'react-use';
import useMount from 'react-use/lib/useMount';
import { euiStyled } from '../../../../../../../observability/public';
import { LogEntryAnomaly } from '../../../../../../common/http_api';
import { TimeRange } from '../../../../../../common/http_api/shared/time_range';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { RIGHT_ALIGNMENT } from '@elastic/eui/lib/services';
import moment from 'moment';
import { i18n } from '@kbn/i18n';
import React, { useCallback, useMemo } from 'react';
import { useSet } from 'react-use';
import useSet from 'react-use/lib/useSet';
import { TimeRange } from '../../../../../../common/http_api/shared/time_range';
import {
formatAnomalyScore,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { useMemo, useState, useCallback, useEffect, useReducer } from 'react';
import { useMount } from 'react-use';
import useMount from 'react-use/lib/useMount';
import { useTrackedPromise, CanceledPromiseError } from '../../../utils/use_tracked_promise';
import { callGetLogEntryAnomaliesAPI } from './service_calls/get_log_entry_anomalies';
import { callGetLogEntryAnomaliesDatasetsAPI } from './service_calls/get_log_entry_anomalies_datasets';
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/infra/public/pages/logs/page_content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiButtonEmpty } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React from 'react';
import { Route, Switch } from 'react-router-dom';
import { useMount } from 'react-use';
import useMount from 'react-use/lib/useMount';

import { AlertDropdown } from '../../alerting/log_threshold';
import { useKibana } from '../../../../../../src/plugins/kibana_react/public';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import React, { useCallback, useEffect } from 'react';
import { useInterval } from 'react-use';
import useInterval from 'react-use/lib/useInterval';

import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui';
import { AutoSizer } from '../../../../components/auto_sizer';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
import React, { memo, useEffect, useState } from 'react';
import ReactDOM from 'react-dom';
import { useObservable } from 'react-use';
import useObservable from 'react-use/lib/useObservable';
import { HashRouter as Router, Redirect, Switch, Route, RouteProps } from 'react-router-dom';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import './filter_popover.scss';

import React, { MouseEventHandler, useState } from 'react';
import { useDebounce } from 'react-use';
import useDebounce from 'react-use/lib/useDebounce';
import { EuiPopover, EuiSpacer } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FilterValue, defaultLabel, isQueryValid } from '.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import './advanced_editor.scss';

import React, { useState, MouseEventHandler } from 'react';
import { i18n } from '@kbn/i18n';
import { useDebounce } from 'react-use';
import useDebounce from 'react-use/lib/useDebounce';
import {
EuiFlexGroup,
EuiFlexItem,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import React, { useEffect, useState } from 'react';
import { i18n } from '@kbn/i18n';
import { useDebounce } from 'react-use';
import useDebounce from 'react-use/lib/useDebounce';
import {
EuiButtonEmpty,
EuiFormRow,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import React, { useState, useEffect } from 'react';
import { useDebounce } from 'react-use';
import useDebounce from 'react-use/lib/useDebounce';
import { EuiFieldText, keys } from '@elastic/eui';
import { i18n } from '@kbn/i18n';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ import { shallow } from 'enzyme';
import { EuiRange } from '@elastic/eui';
import { ValuesRangeInput } from './values_range_input';

jest.mock('react-use', () => ({
useDebounce: (fn: () => void) => fn(),
}));
jest.mock('react-use/lib/useDebounce', () => (fn: () => void) => fn());

describe('ValuesRangeInput', () => {
it('should render EuiRange correctly', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import React, { useState } from 'react';
import { useDebounce } from 'react-use';
import useDebounce from 'react-use/lib/useDebounce';
import { i18n } from '@kbn/i18n';
import { EuiRange } from '@elastic/eui';

Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/lens/public/pie_visualization/toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import './toolbar.scss';
import React, { useState } from 'react';
import { useDebounce } from 'react-use';
import useDebounce from 'react-use/lib/useDebounce';
import { i18n } from '@kbn/i18n';
import {
EuiFlexGroup,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import React, { useState, useLayoutEffect, useCallback } from 'react';
import { usePromise } from 'react-use';
import usePromise from 'react-use/lib/usePromise';
import { History } from 'history';

import { i18n } from '@kbn/i18n';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Provider } from 'react-redux';
import { I18nProvider } from '@kbn/i18n/react';
import { Router } from 'react-router-dom';
import { History } from 'history';
import { useObservable } from 'react-use';
import useObservable from 'react-use/lib/useObservable';
import { Store } from 'redux';
import { EuiThemeProvider } from '../../../../../xpack_legacy/common';
import { KibanaContextProvider } from '../../../../../../../src/plugins/kibana_react/public';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
} from '@elastic/eui';

import { cloneDeep } from 'lodash';
import { useUpdateEffect } from 'react-use';
import useUpdateEffect from 'react-use/lib/useUpdateEffect';
import { AggName } from '../../../../../../common/types/aggregations';
import { dictionaryToArray } from '../../../../../../common/types/common';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import React, { useContext, useMemo } from 'react';
import { EuiFormRow, EuiSelect } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { useUpdateEffect } from 'react-use';
import useUpdateEffect from 'react-use/lib/useUpdateEffect';
import { CreateTransformWizardContext } from '../../../../wizard/wizard';
import { commonFilterAggs, filterAggsFieldSupport } from '../constants';
import { IndexPattern } from '../../../../../../../../../../../../src/plugins/data/public';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import React, { useCallback, useContext, useEffect, useState } from 'react';
import { EuiComboBox, EuiFormRow } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { debounce } from 'lodash';
import { useUpdateEffect } from 'react-use';
import useUpdateEffect from 'react-use/lib/useUpdateEffect';
import { i18n } from '@kbn/i18n';
import { isEsSearchResponse } from '../../../../../../../../../common/api_schemas/type_guards';
import { useApi } from '../../../../../../../hooks';
Expand Down
Loading