mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[lens] Fix Tag cloud warning about container being too small never disappears (#159611)
Closes https://github.com/elastic/kibana/issues/159494 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
4d794f5a7b
commit
e581d57b5e
1 changed files with 16 additions and 4 deletions
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import React, { useCallback, useState, useMemo } from 'react';
|
||||
import React, { useCallback, useEffect, useState, useMemo } from 'react';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import { throttle } from 'lodash';
|
||||
import { EuiIconTip, EuiResizeObserver } from '@elastic/eui';
|
||||
|
@ -84,9 +84,11 @@ export const TagCloudChart = ({
|
|||
const [warning, setWarning] = useState(false);
|
||||
const { bucket, metric, scale, palette, showLabel, orientation } = visParams;
|
||||
|
||||
const bucketFormatter = bucket
|
||||
? getFormatService().deserialize(getFormatByAccessor(bucket, visData.columns))
|
||||
: null;
|
||||
const bucketFormatter = useMemo(() => {
|
||||
return bucket
|
||||
? getFormatService().deserialize(getFormatByAccessor(bucket, visData.columns))
|
||||
: null;
|
||||
}, [bucket, visData.columns]);
|
||||
|
||||
const tagCloudData = useMemo(() => {
|
||||
const bucketColumn = bucket ? getColumnByAccessor(bucket, visData.columns)! : null;
|
||||
|
@ -120,6 +122,16 @@ export const TagCloudChart = ({
|
|||
visData.rows,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
// clear warning when data changes
|
||||
if (warning) {
|
||||
setWarning(false);
|
||||
}
|
||||
// "warning" excluded from dependencies.
|
||||
// Clear warning when "tagCloudData" changes. Do not clear warning when "warning" changes.
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [tagCloudData]);
|
||||
|
||||
const label = bucket
|
||||
? `${getColumnByAccessor(bucket, visData.columns)!.name} - ${
|
||||
getColumnByAccessor(metric, visData.columns)!.name
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue