mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-31 13:47:02 +02:00
fix: console errors from highlight component and tag key prop placement (#8669)
Addressing some oversights that led to browser console errors. This PR fixes console errors related to the recently introduced highlight component (#8643) and tag row component in the new flag metadata panel (#8663).
This commit is contained in:
parent
314a4d7113
commit
328fac39a2
@ -1,5 +1,5 @@
|
|||||||
import { alpha, styled } from '@mui/material';
|
import { alpha, styled } from '@mui/material';
|
||||||
import type { ReactNode } from 'react';
|
import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';
|
||||||
import { useHighlightContext } from './HighlightContext';
|
import { useHighlightContext } from './HighlightContext';
|
||||||
import type { HighlightKey } from './HighlightProvider';
|
import type { HighlightKey } from './HighlightProvider';
|
||||||
|
|
||||||
@ -27,17 +27,23 @@ const StyledHighlight = styled('div', {
|
|||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
interface IHighlightProps {
|
interface IHighlightProps extends HTMLAttributes<HTMLDivElement> {
|
||||||
highlightKey: HighlightKey;
|
highlightKey: HighlightKey;
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Highlight = ({ highlightKey, children }: IHighlightProps) => {
|
export const Highlight = forwardRef<HTMLDivElement, IHighlightProps>(
|
||||||
const { isHighlighted } = useHighlightContext();
|
({ highlightKey, children, ...props }, ref) => {
|
||||||
|
const { isHighlighted } = useHighlightContext();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledHighlight highlighted={isHighlighted(highlightKey)}>
|
<StyledHighlight
|
||||||
{children}
|
ref={ref}
|
||||||
</StyledHighlight>
|
highlighted={isHighlighted(highlightKey)}
|
||||||
);
|
{...props}
|
||||||
};
|
>
|
||||||
|
{children}
|
||||||
|
</StyledHighlight>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
@ -128,13 +128,13 @@ export const TagRow = ({ feature }: IFeatureOverviewSidePanelTagsProps) => {
|
|||||||
const tagLabel = `${tag.type}:${tag.value}`;
|
const tagLabel = `${tag.type}:${tag.value}`;
|
||||||
return (
|
return (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
|
key={tagLabel}
|
||||||
title={
|
title={
|
||||||
tagLabel.length > 35 ? tagLabel : ''
|
tagLabel.length > 35 ? tagLabel : ''
|
||||||
}
|
}
|
||||||
arrow
|
arrow
|
||||||
>
|
>
|
||||||
<StyledAddedTag
|
<StyledAddedTag
|
||||||
key={tagLabel}
|
|
||||||
label={tagLabel}
|
label={tagLabel}
|
||||||
size='small'
|
size='small'
|
||||||
deleteIcon={
|
deleteIcon={
|
||||||
|
Loading…
Reference in New Issue
Block a user