Skip to content

Commit

Permalink
Fix incorrect dependency lists
Browse files Browse the repository at this point in the history
  • Loading branch information
weltenwort committed Dec 2, 2019
1 parent 4e0f0db commit c366a36
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export const useFormattedTime = (

const dateFormat = formatMap[format];
const formattedTime = useMemo(() => getFormattedTime(time, dateFormat, fallbackFormat), [
getFormattedTime,
time,
dateFormat,
fallbackFormat,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const LogEntryActionsMenu: React.FunctionComponent<{
/>
</EuiContextMenuItem>,
],
[uptimeLink]
[apmLink, uptimeLink]
);

const hasMenuItems = useMemo(() => menuItems.length > 0, [menuItems]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const useMeasuredCharacterDimensions = (scale: TextScale) => {
X
</MonospaceCharacterDimensionsProbe>
),
[scale]
[measureElement, scale]
);

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const SavedViewCreateModal = ({ close, save }: Props) => {
const saveView = useCallback(() => {
save(viewName, includeTime);
close();
}, [viewName, includeTime]);
}, [close, includeTime, save, viewName]);

return (
<EuiOverlayMask>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const AddLogColumnButtonAndPopover: React.FunctionComponent<{

addLogColumn(selectedOption.columnConfiguration);
},
[addLogColumn, availableColumnOptions]
[addLogColumn, availableColumnOptions, closePopover]
);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const useSourceConfigurationFormState = (configuration?: SourceConfigurat
const resetForm = useCallback(() => {
indicesConfigurationFormState.resetForm();
logColumnsConfigurationFormState.resetForm();
}, [indicesConfigurationFormState.resetForm, logColumnsConfigurationFormState.formState]);
}, [indicesConfigurationFormState, logColumnsConfigurationFormState]);

const isFormDirty = useMemo(
() => indicesConfigurationFormState.isFormDirty || logColumnsConfigurationFormState.isFormDirty,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,33 @@ import {
} from '../../graphql/types';
import { findInventoryModel } from '../../../common/inventory_models';

interface Props {
interface WaffleInventorySwitcherProps {
nodeType: InfraNodeType;
changeNodeType: (nodeType: InfraNodeType) => void;
changeGroupBy: (groupBy: InfraSnapshotGroupbyInput[]) => void;
changeMetric: (metric: InfraSnapshotMetricInput) => void;
}

export const WaffleInventorySwitcher = (props: Props) => {
export const WaffleInventorySwitcher: React.FC<WaffleInventorySwitcherProps> = ({
changeNodeType,
changeGroupBy,
changeMetric,
nodeType,
}) => {
const [isOpen, setIsOpen] = useState(false);
const closePopover = useCallback(() => setIsOpen(false), []);
const openPopover = useCallback(() => setIsOpen(true), []);
const goToNodeType = useCallback(
(nodeType: InfraNodeType) => {
(targetNodeType: InfraNodeType) => {
closePopover();
props.changeNodeType(nodeType);
props.changeGroupBy([]);
const inventoryModel = findInventoryModel(nodeType);
props.changeMetric({
changeNodeType(targetNodeType);
changeGroupBy([]);
const inventoryModel = findInventoryModel(targetNodeType);
changeMetric({
type: inventoryModel.metrics.defaultSnapshot as InfraSnapshotMetricType,
});
},
[props.changeGroupBy, props.changeNodeType, props.changeMetric]
[closePopover, changeNodeType, changeGroupBy, changeMetric]
);
const goToHost = useCallback(() => goToNodeType('host' as InfraNodeType), [goToNodeType]);
const goToK8 = useCallback(() => goToNodeType('pod' as InfraNodeType), [goToNodeType]);
Expand Down Expand Up @@ -68,10 +73,10 @@ export const WaffleInventorySwitcher = (props: Props) => {
],
},
],
[]
[goToDocker, goToHost, goToK8]
);
const selectedText = useMemo(() => {
switch (props.nodeType) {
switch (nodeType) {
case InfraNodeType.host:
return i18n.translate('xpack.infra.waffle.nodeTypeSwitcher.hostsLabel', {
defaultMessage: 'Hosts',
Expand All @@ -81,7 +86,7 @@ export const WaffleInventorySwitcher = (props: Props) => {
case InfraNodeType.container:
return 'Docker';
}
}, [props.nodeType]);
}, [nodeType]);

return (
<EuiFilterGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const useLogAnalysisCapabilities = () => {

useEffect(() => {
fetchMlCapabilities();
}, []);
}, [fetchMlCapabilities]);

const isLoading = useMemo(() => fetchMlCapabilitiesRequest.state === 'pending', [
fetchMlCapabilitiesRequest.state,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export const useLogAnalysisJobs = ({

const viewResults = useCallback(() => {
dispatch({ type: 'viewedResults' });
}, []);
}, [dispatch]);

const cleanupAndSetup = useCallback(
(indices: string[], start: number | undefined, end: number | undefined) => {
Expand All @@ -127,16 +127,16 @@ export const useLogAnalysisJobs = ({
dispatch({ type: 'failedSetup' });
});
},
[cleanupMLResources, setupMlModule]
[cleanupMLResources, dispatch, setupMlModule]
);

const viewSetupForReconfiguration = useCallback(() => {
dispatch({ type: 'requestedJobConfigurationUpdate' });
}, []);
}, [dispatch]);

const viewSetupForUpdate = useCallback(() => {
dispatch({ type: 'requestedJobDefinitionUpdate' });
}, []);
}, [dispatch]);

useEffect(() => {
fetchModuleDefinition();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const useLogAnalysisResults = ({

useEffect(() => {
getLogEntryRate();
}, [sourceId, startTime, endTime, bucketDuration, lastRequestTime]);
}, [bucketDuration, endTime, getLogEntryRate, lastRequestTime, sourceId, startTime]);

const logRateResults: LogRateResults | null = useMemo(() => {
if (logEntryRate) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const useLogEntryHighlights = (
} else {
setLogEntryHighlights([]);
}
}, [highlightTerms, startKey, endKey, filterQuery, sourceVersion]);
}, [endKey, filterQuery, highlightTerms, loadLogEntryHighlights, sourceVersion, startKey]);

const logEntryHighlightsById = useMemo(
() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,15 @@ export const useLogSummaryHighlights = (
} else {
setLogSummaryHighlights([]);
}
}, [highlightTerms, start, end, bucketSize, filterQuery, sourceVersion]);
}, [
bucketSize,
debouncedLoadSummaryHighlights,
end,
filterQuery,
highlightTerms,
sourceVersion,
start,
]);

return {
logSummaryHighlights,
Expand Down

0 comments on commit c366a36

Please sign in to comment.