Skip to content

Commit

Permalink
fix: remove useCallback hooks in favour of mount-time references
Browse files Browse the repository at this point in the history
  • Loading branch information
amlmtl committed Nov 3, 2023
1 parent 00b749a commit 3d85621
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/components/ConfigEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
SPDX-License-Identifier: Apache-2.0
*/

import React, {useCallback, useEffect, useMemo, useRef} from 'react';
import React, {useEffect, useMemo, useRef} from 'react';
import {Checkbox, HorizontalGroup, InlineLabel, Select, VerticalGroup} from '@grafana/ui';
import {DataSourcePluginOptionsEditorProps, SelectableValue} from '@grafana/data';
import {EspDataSourceOptions} from '../types';
Expand Down Expand Up @@ -32,15 +32,15 @@ export function ConfigEditor({options, onOptionsChange}: DataSourcePluginOptions
return matchingOption ? matchingOption : {value: discoveryServiceUrl, label: discoveryServiceUrl};
}

const changePropOptions = useCallback((change: Object) => {
const changePropOptions = (change: Object) => {
const newOptions = {...options, ...change};
onOptionsChange(newOptions);
}, [options, onOptionsChange])
}

const changePropOptionsJsonData = useCallback((change: Object) => {
const changePropOptionsJsonData = (change: Object) => {
const newJsonData = {...jsonData, ...change};
changePropOptions({jsonData: newJsonData});
}, [changePropOptions, jsonData])
}

const handleDiscoveryServiceProviderChange = (selectedOption: SelectableValue<string>) => {
changePropOptions({url: selectedOption.value});
Expand Down

0 comments on commit 3d85621

Please sign in to comment.